Frequency Counter using PIC16F877A Microcontroller
This PIC frequency counter project uses an LCD to display the frequency and PIC timer 1 (TMR1) to measure the input signal.
It uses TMR1 in 16 bit counter mode to count the input signal edges and overflows of the counter are accumulated to give the total count in multiples of 65536.
Adding the current value of the counter at the end gives the total count.
Since the measurement time is 1 second the final count is actually the frequency of the input signal.
Using the 1 second measurement time also gives a frequency resolution of 1 Hz.
For the general theory of operation of this circuit and notes on frequency counting of this pic frequency counter click here.
The LCD is used in 4 bit mode interface so you only need 4 data lines and three control lines and it then fits into a single 8 bit port.
The crystal oscillator is simply a crystal and two capacitors connected to the PIC oscillator port at OSC1 and OSC2. The capacitors can both be fixed at the same value unless you want to tune it using a frequency reference. If you don’t have an accurate reference then use fixed capacitors.
The PIC micro can be any type that has a Timer 1 hardware and and has enough memory to hold the program.
The LED is toggled at the end of every gate time to indicate that the processor is alive – so if there is no input signal you can tell that the software is working.
You can program the PIC in circuit through the ICSP connector.
PIC frequency counter Software
Project files for the PIC frequency counter
Compiler project files
C Source files.
For a tutorial on compiling these files click here.
You only need to recompile the pic frequency counter files if you want to change the source code or examine how the code works using the built in simulator since the hex file to program the chip is included in the download.
For more detail: Frequency Counter using PIC16F877A Microcontroller
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
Current Project / Post can also be found using:
- schematic frequency meter pic ccs
- pic frequency counter
- pic16f877a counter program
- frequency counter using pic microcontroller