Timer 1 Notes LMS
Timer 1 Notes LMS
The Timerl module is a 16-bit timer/counterconsisting of two 8-bit registers (TMRIH and
TMRI L) which are readable and writable.The TMRI Register pair (TMRIH:TMRIL) increments
from 0000h to FFFFh and rolls over to 0000h. The Timerl Interrupt,if enabled, is generated on
overflowwhich is latched in the TMRI IF interruptflag bit.This interruptcan be enabled/disabled
by setting/clearingthe TMRI IE interruptenable bit.
TimerI can operate in one of three modes:
• As a synchronoustimer
• As a synchronouscounter
• As an asynchronouscounter
The operating mode is determined by clock select bit, TMRI CS (Tl CON<I >), and the synchro-
nization bit, TfSYNC (Figure 12-1).
In timer mode, Timerl increments every instruction cycle. In counter mode, it increments on
every rising edge of the external clock input on pin Tl CKI.
Timerl can be turned on and off using theTMRION control bit
TimerI also has an internal"reset input', which can be generated by a CCP module.
Timerl has the capabilityto operate off an external crystal. When the Timerl oscillator is enabled
(TI OSCEN is set), the TI OSI and TI OSO pins become inputs.That is, their correspondingTRIS
values are ignored.
Legend
R = Readable bit W = Writablebit
U = Unimplemented bit, read as 'O' - n = Value at POR reset
Timerl Operation in Timer Mode
Timer mode is selected by clearing the TMRICS (Tl bit. In this mode, the input clock
to the timer is Fosc/4. The synchronize controlbit,ffSYNC (Tl has no effect since
the internalclock is always synchronized.
Timerl Operation in Synchronized Counter Mode
Counter mode is selected by setting the TMRI CS bit. In this mode the timer increments on every
rising edge of clock input on the Tl OSI pin when the oscillator enable bit (Tl OSCEN) is set, or
the Tl OSO/TICKI pin when the Tl OSCEN bit is cleared.
If the TfSYNC bit is cleared, then the external clock input is synchronized with internal phase
clocks. The synchronizationis done after the prescaler stage. The prescaler is an asynchronous
ripple-counter.
In this configuration,during SLEEP mode,Timerl will not incrementeven if the external clock is
present, since the synchronization circuit is shut off. The prescaler however will continue to
increment.