100MHz frequency counter with PIC16F628A – LED Display
- Hristo
- http://diyfan.blogspot.com
- xristost@yahoo.com
- 24.754 Views
- moderate
- Tested
Couple of weeks ago I purchased from eBay one of these amazingly cheap an useful modules with MAX7219 LED driver and 8 digit LED display. It is ideal for frequency counter project. The problem was the absence of library for PIC microcontrolers. Luckily, I found a great library for Arduino and I reworked it to be compatible with PIC. The schematic of the frequency counter is actually almost the same as the previous . It uses PIC16F628A microcontroller with external 32.768kHz watch crystal attached to Timer1 to generate 1 second time base. Measured signal is fed to pin3 (RA4) which is counted by Timer0.
The program make short (0.125s) test of the input signal to determine the prescaler value. Next is the actual counting with the proper prescaler value and then the result is send to the display.
This is fast breadboard proof-of-concept project, and I don’t intend to make a finished product, for now at least. Of course there must be some sort of preamplifier/protection in front of the frequency counter in order to be usable.
In the pictures below is shown the breadboard and five different quartz crystals generating different frequencies. The differences between the value on the display and the value on the oscilloscope are negligible. I tested the schematic also with frequencies above 90 MHz and even above 100Mhz and the results was accurate, but of course most significant digit was lost in case of 100+ MHz.
Schematic
In your pictures it looks like you have more components than what’s on the schematic. What are the extra IC, transistor, and stuff for? Also, when you compiled your programs, did you just use MPLab?
Thanks.
This is a proof of concept project and the schematic is incomplete. As far as i know the extra IC is a preamplifier and signal condition circuit and the “transistor” like component is a LM7805 +5V linear regulator to power the whole circuit. Regarding the other question we should get the answer of the author.
I have just tried to compiled this code but unsuccessful with this notification : 182 375 Const expression expected max7219.c, using MicroC for PIC. where is the problem are?