PIC based Frequency Counter

The Software

The frequency to be measured is input directly to the external Timer0 input with the internal prescaler configured to divide by 256. The microprocessor monitors the prescaler to detect an overflow and upon occurence, adds 256 to the frequency count which is summed directly in BCD. At the end of the gate time, which is 1 second in the 50 Mhz unit, 640 milliseconds in the 1 GHz unit and 1.024 second in the 6 GHz unit, the prescaler is clocked under microprocessor control until it overflows to determine the residual count which is then added to the BCD registers to obtain the total count

The readouts are driven with lead zero blanking to the left of the decimal point. The count is auto-ranged by offsetting the displayed digits. Note that the internal count is a full 8 digits which may be displayed if desired with a minor software change and the addition of another display in a slightly larger cabinet.

The 1 Ghz and 6 Ghz versions do not require auto ranging. The 1 Ghz display is in MHz with 3 digits to the left of the decimal point. The 6 Ghz display is also in MHz but with 4 digits to the left of the decimal point.

The Source Listing

Ooops, this is quite too large to put in line... I'll figure out how to put it in a file when I get a moment.

The Hex Listing -- 50 MHz version

This is direct from Microchip's MPLAB v.5.62.00