English
Language : 

C8051F80X_14 Datasheet, PDF (219/251 Pages) Silicon Laboratories – Mixed Signal ISP Flash MCU Family
C8051F80x-83x
28.2. Timer 2
Timer 2 is a 16-bit timer formed by two 8-bit SFRs: TMR2L (low byte) and TMR2H (high byte). Timer 2 may
operate in 16-bit auto-reload mode or (split) 8-bit auto-reload mode. The T2SPLIT bit (TMR2CN.3) defines
the Timer 2 operation mode. Timer 2 can also be used in capture mode to capture rising edges of the
Comparator 0 output.
Timer 2 may be clocked by the system clock, the system clock divided by 12, or the external oscillator
source divided by 8. The external clock mode is ideal for real-time clock (RTC) functionality, where the
internal oscillator drives the system clock while Timer 2 (and/or the PCA) is clocked by an external oscilla-
tor source. The external oscillator source divided by 8 is synchronized with the system clock when in all
operating modes except suspend. When the internal oscillator is placed in suspend mode, The external
clock/8 signal can directly drive the timer. This allows the use of an external clock to wake up the device
from suspend mode. The timer will continue to run in suspend mode and count up. When the timer over-
flow occurs, the device will wake from suspend mode, and begin executing code again. The timer value
may be set prior to entering suspend, to overflow in the desired amount of time (number of clocks) to wake
the device. If a wake-up source other than the timer wakes the device from suspend mode, it may take up
to three timer clocks before the timer registers can be read or written. During this time, the STSYNC bit in
register OSCICN will be set to 1, to indicate that it is not safe to read or write the timer registers.
28.2.1. 16-bit Timer with Auto-Reload
When T2SPLIT (TMR2CN.3) is zero, Timer 2 operates as a 16-bit timer with auto-reload. Timer 2 can be
clocked by SYSCLK, SYSCLK divided by 12, or the external oscillator clock source divided by 8. As the
16-bit timer register increments and overflows from 0xFFFF to 0x0000, the 16-bit value in the Timer 2
reload registers (TMR2RLH and TMR2RLL) is loaded into the Timer 2 register as shown in Figure 28.4,
and the Timer 2 High Byte Overflow Flag (TMR2CN.7) is set. If Timer 2 interrupts are enabled (if IE.5 is
set), an interrupt will be generated on each Timer 2 overflow. Additionally, if Timer 2 interrupts are enabled
and the TF2LEN bit is set (TMR2CN.5), an interrupt will be generated each time the lower 8 bits (TMR2L)
overflow from 0xFF to 0x00.
T2XCLK
CKCON
TTTTTTSS
3 3 2 2 1 0CC
MMMMMMA A
HLHL
10
SYSCLK / 12
0
External Clock / 8
1
SYSCLK
0
TR2
1
TL2
Overflow
TCLK
TMR2L
To SMBus
TMR2H
TMR2RLL TMR2RLH
Reload
To ADC,
SMBus
TF2H
TF2L
TF2LEN
TF2CEN
T2SPLIT
TR2
T2XCLK
Figure 28.4. Timer 2 16-Bit Mode Block Diagram
Interrupt
Rev. 1.0
219