User Manual
499
Rev. 1.1
2019-03-18
TLE984xQX
Microcontroller with LIN and Power Switches for Automotive Applications
Timer2 and Timer21
17.3.1.2 Up/Down Count Enabled
If DCEN = 1, the up-down count selection is enabled. The direction of count is determined by the level at input
pin T2EX. The operational block diagram is shown in
.
A logic 1 at pin T2EX sets the Timer 2 to up counting mode. The timer, therefore, counts up to a maximum of
FFFF
H
. Upon overflow, bit TF2 is set and the timer register is reloaded with a 16-bit reload value of the RC2
register. A fresh count sequence is started and the timer counts up from this reload value as in the previous
count sequence. This reload value is chosen by software, prior to the occurrence of an overflow condition.
A logic 0 at pin T2EX sets the Timer 2 to down counting mode. The timer counts down and underflows when
the THL2 value reaches the value stored at register RC2. The underflow condition sets the TF2 flag and causes
FFFF
H
to be reloaded into the THL2 register. A fresh down counting sequence is started and the timer counts
down as in the previous counting sequence.
If bit T2RHEN is set, Timer 2 can only be started either by rising edge (T2REGS = 1) at pin T2EX and then do the
up counting, or be started by falling edge (T2REGS = 0) at pin T2EX and then do the down counting.
In this mode, bit EXF2 toggles whenever an overflow or an underflow condition is detected. This flag, however,
does not generate an interrupt request.
Figure 116 Auto-Reload Mode (DCEN = 1)
TF2
EXF2
THL2
OR
TR2
Overflow
Timer 2
Interrupt
16-bit
Comparator
FFFF
H
(Down count reload)
Underflow
T2EX
f
sys
prescaler
PREN
RC2
( 12)
÷