Intro To Digital Timers:

The Theory
           The theory of setting up the timers is strictly a matter of software. Since the timers are completely inside the PIC there really is no hardware requirement other than wiring up power, ground, a clock & some leds.

How The Timer Works
           Timers work very simply, they count each instruction until they get to their maximum value. The PIC we're using has both 8-bit and 16-bit timers which means it can count to:
-> 8-Bits = 256 Instruction Cycles
-> 16-Bits = 65536 Instruction Cycles

This creates awesome flexibility for counting to all sorts of values. Even more, all timers will have pre & post-scalars. This means that instead of just adding 1 to the counter every instruction cycle you could instead add 2, 4, 8, 16, 32....256. This is especially usful when specific & fast timing is necessary.

The Different Timers
           Each timer has a unique function aside from counting instruction cycles. They all offer the functionality to trigger interrupt when they overflow. Overflow means the count buffer becomes larger than it can handle (0xFF + 1 or 0xFFFF + 1 would overflow 8-Bit,16-Bit).
           Timer 0 & Timer 1 give up to 16-bit resolution which can ran fairly slow compared to the others that run upto only 8-bit.
           Timer 2 is used specifically with the PWM functions on the PIC. PWM pulse frequencies, duty cycles and everything else required for PWM is generated the hardware timer 2.
           Timer3 can be used very easily with an external oscillator input. This means the PIC can run at one frequency and timer3 at another. This offers certain timing advantages for slower & faster timing needs than the current oscillator provides to the PIC.



;