Saturday, September 25, 2010

PIC12F683 Timer1 Module + Frequency Counter + MikroC

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.






0 comments:

Post a Comment