Browse over 10,000 Electronics Projects

A one chip frequency counter with serial output

A one chip frequency counter with serial output

Design for a single chip frequency counter using PIC12F675. It is possible to use the internal RC oscillator, instead of the crystal but the accuracy suffers.
The counter uses the 8 bit counter TMR0. The main loop samples the timer value, subtracts the sample from the last sample and adds the difference to a count. This is done over exactly 2 seconds, done by counting processor cycles, in a loop that cannot be interrupted. TMR0 is configured so that the input is divided by two.

The binary count is converted to BCD and this is output serially at 1200 baud.



Advertisement1


GP3 controls if the comparator is used to pre-amplify the signal. if GP3 is high, then GP2 is Freq counter input. if GP3 is low, then GP1 is Freq counter input. It uses the Comparator and Vref set to about 1 volt.

Why serial? With only 8 pins, it is not possible to connect an LCD display using a parallel interface, and my serial LCD works quite well at 1200 baud.

You could use a serial terminal on a PC to capture the frequency.

Visit Here for more.

 


Top