Specifications
mikroElektronika | Free Online Book | PIC Microcontrollers | Introduction: World of Microcontrollers
Fig. 0-27 Timers/Counters
same width, which makes them ideal for time measurement. Such oscillators are used in quartz watches. If it is necessary to measure time
between two events, it is sufficient to count pulses coming from this oscillator. That is exactly what the timer does.
Most programs use these miniature electronic “stopwatches”. These are commonly 8- or 16-bit SFRs and their content is automatically
incremented by each coming pulse. Once a register is completely loaded - an interrupt is generated!
If the timer registers use an internal quartz oscillator for their operation then it is possible to measure time between two events (if the register
value is T1 at the moment measurement has started, and T2 at the moment it has finished, then the elapsed time is equal to the result of
http://www.mikroe.com/en/books/picmcubook/ch0/ (21 of 30)5/3/2009 11:28:39 AM