This browser does not support JavaScript.

A PIC based Frequency Counter in an Altoids tin

This has been done before, but I wanted a frequency counter and decided to do it myself just for fun. The counter is based upon a 16F84 PIC processor and using the counter/timer input as described in one of the PIC application notes. My version uses the overflow bit in one of the status registers to get 24 bits of precision in the counter. The 3 LED displays show the measurement in Mhz, Khz, and hundreds. The gate time is 100 ms but I decided not to display the tens of hz, as it's probably not that accurate. Offsets of plus or minus 9 Mhz are selected with a pushbutton switch for use with a radio with a 9 Mhz IF.

The code is written in C and compiled using my own compiler. I had some problems with the preamp for the signal and tried a number of circuits using bipolar transistors and FET's. RadioShack no longer stocks the CMOS logic gates - my first choice for the input. I finally cut a 74ACT04 off of an old video board I had in the basement and finally got a sensitive circuit that provided stable counts.

I spent considerable time getting the counter pin to work. This problem was caused by some code for assigning the prescaler that I copied incorrectly from the manual. This is my 2nd PIC based project and it is not easy to debug a system when there is little to no visibility into what exactly the microcode is doing.

The frequency is displayed as Mhz, then Khz, then the 100 hz digit.