PIC Audio Frequency Counter

Like the thermometer, this project uses a PIC16F684. This time I'm using the internal clock, and timer1 configured as a counter. Both LCD and LED (6 digit) displays were implemented. All you need to do is let the counter run for exactly 1 second and display the output of timer1 counter. (Well its not quite that easy since timer1's 16 bit counter limits you to 65535 counts (or in this case Hz), but if you count the overflows in an interrupt handling routine, you can get a lot more bits. With a 6 digit LED display I can show up to 999999 Hz.)


The LED version is a lot more complicated and pushes the envelope of how many LED displays you can drive from a PIC. I used the MAN6740 dual-digit LED displays, now obsolete, because they were left over from another project years ago. To accomodate the limited number of I/O pins in the 16F684, I used a 4028 decoder to select the digit, so I only needed 3 I/Os to select 6 digits. The circuit would have been a lot cleaner if I had the extra 3 I/Os and dispensed with the 4028. (If I were implementing this project again, I would choose the PIC16F685, which is simply a PIC16F684 with a lot more I/O pins.) The processor is displaying only one digit at a time, so each digit is on for 1/6 of the time and off for 5/6 of the time. The result is a dim display, partly offset by reducing the resistors limiting each segment of the display from the usual 470 ohms to 220 ohms. A more modern LED display would have been much brighter too.

Download C source code for LCD frequency counter ( SourceBoost BoostC)

Download C source code for LED frequency counter ( SourceBoost BoostC)


Back to VE3LNY's PIC Project Page