Introduction
Author: Robert Perkel, Microchip Technology Inc. |
Timers are a ubiquitous peripheral in microcontrollers. It should come as no surprise that there are a lot of timers, each optimized for specific applications. Some timers are designed to be used as part of waveform generation, while others are ideal for pulse counting. Often, there is no wrong choice—instead, it will depend on the requirements and resources available. This document covers the timers currently available on PIC® microcontrollers. A companion document covers the timers on AVR® microcontrollers.
For this document, a hardware timer is defined as any peripheral that counts clock pulses to perform some action. It could be a standard timer that generates periodic interrupts when it rolls over or something more exotic like a Numerically Controlled Oscillator (NCO). In many cases, it is possible to configure a specialized timer to function as a standard timer or counter by incorporating additional software.