This PIC Is A Squarewave Generator

This PIC Is A Squarewave Generator

When we use a microcontroller to flip a few GPIOs or talk SPI to a peripheral chip, we are often overlooking that it will usually contain an array of built-in peripherals that were once the preserve of extra hardware. Analogue ports, timers, UARTs, and clock generators, to name just a few. [Giovanni Bernardo] has been experimenting with one of these, the internal frequency synthesiser on many PIC microcontrollers, and he’s  produced a handy square wave generator for which he’s placed code on GitHub and produced a write-up (Italian language, Google translate link).


The board used is a PIC16F375 Curiosity Nano, and code takes input from a rotary encoder to set the frequency, with a button to select different step sizes and an alphanumeric LCD display to show the current settings. Frequencies from 1 Hz to 15 MHz are possible, with a clever switch between two of the PICs internal clocks to be used as the reference frequency. Stability depends upon whatever source the PIC uses for its own clock, and while we suspect that will be enough for most users it’s not inconceivable that the PIC could be clocked from a GPS-disciplined source or similar were there a requirement for it.


There are plenty of ways to generate square waves from a microcontroller. Most projects use waveform generator ICs.



Support the originator by clicking the read the rest link below.