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

:10000000050C24006000E403020A610A1A02810060
:1000100043065B0A3700560CF706120CFB01020C74
:10002000F706250CFC01000CF706030CFD01010C82
:10003000F7067F0CFA01060CDB0123063B00600C7F
:10004000DB0103063B000306BC02060CDC012306B1
:100050003C00600CDC0103063C000306BD02060CFC
:10006000DD0123063D00600CDD0103063D000306B3
:10007000BE02060CDE0123063E00600CDE01030614
:100080003E000306BF02060CDF0123063F00000806
:100090000F0E4307770097012500200C2807080C56
:1000A000960106044307E30706051602A60126018A
:1000B000030436030008040C3700F7025D0A080544
:1000C0001B0A4000060005000F0C07000400270C67
:1000D0000200FE0C26007B00E306820A110CFA01E6
:1000E000AA0C9A0043071A024306E3053B003C00B2
:1000F0003D003E00800C3900F8027C0A0400F90241
:100100007C0AC10A0A0C3900C40C380065050604D3
:1001100064007A0061000605060904000000000082
:1001200000000000000000000000000000000000CF
:1001300000000000000000000000000000000000BF
:100140000000000000000000000000000000F802B5
:10015000AA0AF9028C0A0604080406090400080722
:10016000AD0A770065046505B7021A0281014306EE
:10017000B20A37024306C10ABB021B090400F70397
:10018000BC0A0F0C37001E0C2400800C36001E0227
:1001900043062804F00E430728052807D50A8003E4
:1001A00048091606610A76067700000248096000D1
:0801B000E4001607CF0A610A02
:0203FE000400F9