Microchip logo
  • All
  • Products
  • Documents
  • Applications Notes

AN592

Title:
Frequency Counter Using PIC16C5x
Name:
AN592
Date:
03/14/2004
Author:
Stan D'Souza
Description:
The PIC16C5X has one 8-bit timer (Timer0), which can be used with an 8-bit prescaler. The prescaler runs asynchronously, hence it can count a very high frequency. The minimum rise and fall times of the input frequency are specified to be 10 ns, so the fastest clock rate the TMR0 can count is 50 MHz. The prescaler must be used when measuring high frequency. Since the prescaler can be configured as a divide by 256 counter, the maximum resolution at which the input frequency can be measured is 16-bits. However, the prescaler cannot be directly read like a file register. This application note depicts a unique method by which the user can ?extract? the 8-bit value in the prescaler, whereby the resolution of the measurement is 16-bits with the high 8-bits in TMR0 and the low 8-bits in the prescaler. "The PIC16C5X has one 8-bit timer (Timer0) which can use an 8-bit prescaler. In some instances, the user would like to use this timer for some other purpose and yet, be able to do a transmit and receive using the serial port. This application note offers routines to do a simple 8-bit transmit and receive with no handshake, at baud rates from 1200 to 9600. Please note that these routines use a timed loop which is as accurate as the clock which drives the PIC16C5X. The user enters the frequency and baud rate desired. The calculated value ?delay? in the serial routine has to be an 8-bit value only. if the value is greater than 8-bits, the frequency and baud rate values have to be changed." 8-bit transmit and receive with no handshake, at baud rates from 1200 to 9600. Please note that these routines use a timed loop which is as accurate as the clock which drives the PIC16C5X. The user enters the frequency and baud rate desired. The calculated value ?delay? in the serial routine has to be an 8-bit value only. if the value is greater than 8-bits, the frequency and baud rate values have to be changed.
Keywords:
PIC16C5X
 
Application Notes & Source Code
 Last Updated
Size
 
  AN592
  03/14/2004
  130KB
  AN592 Source Code - Frequency Counter Using PIC16C5x
  02/25/2005
  17KB
Silicon Products