Specifications

66
3706C–MICRO–2/11
AT89LP3240/6440
Figure 12-6. Timer 2 Waveform: Auto-Reload Mode (DCEN = 1)
12.3.3 Dual Slope Counter
When Timer 2 Auto-Reload Mode uses Count Mode 2 (T2CM
1-0
= 10B) or Count Mode 3
(T2CM
1-0
= 11B), the timer operates in a dual slope fashion. The timer counts up from MIN to
TOP a nd then counts down from TOP to MIN, following a sawtooth waveform as shown in Fig-
ure 12-7. The EXF2 bit is set/cleared by hardware to reflect the current count direction (Up =
0and Down = 1). The value of TOP stored in RCAP2H and RCAP2L is double-buffered such that
a new TOP value takes affect only after an underflow. The only difference between Mode 2 and
Mode 3 is when the interrupt flag is set. In Mode 2 TF2 is set once per count period when the
timer underflows at MIN. In Mode 3 TF2 is set twice per count period, once when the timer over-
flows at TOP and once when the timer underflows at MIN. The interrupt service routine can
check the EXF2 bit to determine if TF2 was set at TOP or MIN. These count modes are provided
to support variable precision symmetrical PWM in the CCA. DCEN has no effect when using
dual slope operation. The Timer 2 overflow rate for this mode is given in the following equation:
MAX
MIN
BOTTOM
T2CM
1-0
= 00B, DCEN = 1
MAX
MIN
TOP
T2CM
1-0
= 01B, DCEN = 1
T2EX
TF2 Set
TF2 Set
EXF2
Auto-Reload Mode:
DCEN = 0, T2CM = 10B
Time-out Period
RCAP2H RCAP2L{,}2×
Oscillator Frequency
-------------------------------------------------------------------
TPS 1+()×=