Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Introduction: World of Microcontrollers
Fig. 0-30 Using the interrupt in timer operation
This figure illustrates the use of the interrupt in timer operation. Delays of arbitrary duration with minimal interference by the main program
execution can be easily obtained by assigning a prescaler to the timer.
Counters
If a timer is supplying pulses into the microcontroller input pin then it turns into a counter. Clearly, It is the same electronic circuit. The only
difference is that in this case pulses to be counted come through the ports and their duration (width) is mostly not defined. This is why they
cannot be used for time measurement, but can be used to measure anything else: products on an assembly line, number of axis rotation,
passengers etc. (depending on sensor in use).
Watchdog Timer
The Watchdog Timer is a timer connected to a completely separate RC oscillator within the microcontroller.
If the watchdog timer is enabled, every time it counts up to the program end, the microcontroller reset occurs and program execution starts
from the first instruction. The point is to prevent this from happening by using a specific command. The whole idea is based on the fact that
every program is executed in several longer or shorter loops.
If instructions which reset the watchdog timer are set at the appropriate program locations, besides commands being regularly executed, then
the operation of the watchdog timer will not affect program execution. If for any reason (usually electrical noises in industry), the program
counter “gets stuck” on some memory location from which there is no return, the watchdog will not be cleared and the register’s value being
constantly incremented will reach the maximum et voila! Reset occurs!
http://www.mikroe.com/en/books/picmcubook/ch0/ (24 of 30)5/3/2009 11:28:39 AM