Saturday, September 25, 2010

Using PIC Timer1 Module for Counting Frequency of an External Clock Source

The Timer1 module inside PIC12F683 is a 16-bit timer/counter. If used as an asynchronous counter, this module can be used for counting the frequency of an external clock source applied to its GP5/T1CKI port. The following example is a 0-65535 Hz frequency counter using Timer1 module of PIC12F683. The Timer1 module is reset first and then turned ON for 1 sec to count the clock pulses arrived at its T1CKI port during that period. The number of pulses arrived in  second is frequency itself. The measured frequency value is sent to PC through serial port and displayed on a hyperterminal receiver window. If the external clock frequency is over 65535 Hz, Timer1 overflows and an interrupt is generated. In case of the overflow, "Frequency out of range " message is displayed on the window. A 555 Timer IC running as an astable multivibrator is used as the external clock source.

No comments:

Post a Comment

Microcontroller-based Embedded Systems Design