© 2004 Microchip Technology Inc. DS70059C-page 12-15
Section 12. Timers
Timers
12
12.7 Reading and Writing 16-bit Timer Module Registers
• All timer module SFRs can be written to as a byte (8-bits) or as a word (16-bits).
• All timer module SFRs can only be read as a word (16-bits).
12.7.1 Writing to the 16-bit Timers
The timer and its respective period register can be written to while the module is operating. The
user should be aware of the following when byte writes are performed:
• If the timer is incrementing and the low byte of the timer is written to, the upper byte of the
timer is not affected. If 0xFF is written into the low byte of the timer, the next timer count
clock after this write will cause the low byte to rollover to 0x00 and generate a carry into the
high byte of the timer.
• If the timer is incrementing and the high byte of the timer is written to, the low byte of the
timer is not affected. If the low byte of the timer contains 0xFF when the write occurs, the
next timer count clock will generate a carry from the timer low byte and this carry will cause
the upper byte of the timer to increment.
When the TMRx register is written to (word or byte) via an instruction, the TMRx register
increment is masked and does not occur during that instruction cycle.
Writes to a timer with an asynchronous clock source should be avoided in a real-timekeeping
application. See Section 12.4.1 “Timer Mode” for more details.
12.7.2 Reading from the 16-bit Timers
All reads of the timers and their associated SFRs must be word reads (16-bits). A byte read will
have no effect (‘0’ will be returned).
The timer and respective period register can be read while the module is operating. A read of the
TMRx register does not prevent the timer from incrementing during the same instruction cycle.
12.8 Low Power 32 kHz Crystal Oscillator Input
In each device variant, the Low Power 32 kHz Crystal Oscillator is available to a Type A timer
module for Real-Time Clock (RTC) applications.
• The LP Oscillator becomes the clock source for the timer when the LP Oscillator is
enabled and the timer is configured to use the external clock source.
• The LP Oscillator is enabled by setting the LPOSCEN control bit in the OSCCON
register.
• The 32 kHz crystal is connected to the SOSCO/SOSCI device pins.
Refer to Section 7. “Oscillator” for further details.