1 Peripheral Overview
TIMER0
Timer0 can operate either as an 8-bit or 16-bit timer. The 16-bit mode is enabled by setting the T016BIT bit.
- TMR0L is reset
- The contents of TMR0H are copied to the TMR0H buffer for next comparison
In the 16-bit mode, TMR0H:TMR0L form the 16-bit timer value and read and write of the TMR0H register are buffered. Timer0 rolls over to 0x0000 on incrementing past 0xFFFF. This makes the timer free-running. TMR0L/H registers cannot be reloaded in this mode once started. In both 8-bit and 16-bit modes, Timer0 increments on the rising edge of the selected clock source.
TIMER 1/3/5
Timer1 is a 16-bit module which has the following features:
- 16-Bit Timer/Counter register
- Optionally synchronized comparator out
- Multiple Timer1 gate (count enable) sources
- Interrupt-on-Overflow
- Wake-Up on Overflow (external clock, Asynchronous mode only)
- Time base for the capture/compare function with the CCP modules
- Special Event Trigger (with CCP)
The following figure is a simplified diagram showing signal flow through the TMR1.
TIMER 2/4/6
- Free Running Period
- One-shot
- Monostable
Free-Running Period Mode
The value of T2TMR is compared to that of the Period register (T2PR) on each clock cycle. When the two values match, the comparator resets the value of T2TMR to 00h on the next cycle and increments the output postscaler counter. When the postscaler count equals the value in the OUTPS bits of the T2CON register, then a one clock period wide pulse occurs on the TMR2_postscaled output and the postscaler count is cleared.
One-Shot Mode
The One-Shot mode is identical to the Free-Running Period mode except for when the ON bit is cleared and the timer is stopped when T2TMR matches T2PR and will not restart until the ON bit is cycled off and on. The Postscaler (OUTPS) values other than zero are ignored in this mode because the timer is stopped at the first period event and the postscaler is reset when the timer is restarted.
Monostable Mode
Monostable modes are similar to One-Shot modes except for when the ON bit is not cleared and the timer can be restarted by an external Reset event.
- This signal comes from the pin selected by TxCKIPPS.
- TMRx register increments on rising edge.
- Synchronize does not operate while in Sleep.
- See TMRxCLK for clock source selections from device data sheet.
- See TMRxGATE for gate source selection from device data sheet.
- Synchronized comparator output should not be used in conjunction with synchronized input clock.