User Manual
500
Rev. 1.1
2019-03-18
TLE984xQX
Microcontroller with LIN and Power Switches for Automotive Applications
Timer2 and Timer21
17.3.2
Capture Mode
In order to enter the 16-bit capture mode, bits CP_RL2 and EXEN2 in register T2CON must be set. In this mode,
the down count function must remain disabled. The timer functions as a 16-bit timer or counter and always
counts up to FFFF
H
and overflows. Upon an overflow condition, bit TF2 is set and the timer reloads its registers
with 0000
H
. The setting of TF2 generates an interrupt request to the core.
Additionally, with a falling/rising edge on pin T2EX (chosen by T2MOD.EDGESEL) the contents of the timer
register (THL2) are captured into the RC2 register. The external input is sampled in every
f
sys
cycle. When a
sampled input shows a low (high) level in one
f
sys
cycle and a high (low) in the next
f
sys
cycle, a transition is
recognized. If the capture signal is detected while the counter is being incremented, the counter is first
incremented before the capture operation is performed. This ensures that the latest value of the timer register
is always captured.
If bit T2RHEN is set, Timer 2 is started by first falling edge/rising edge at pin T2EX, which is defined by bit
T2REGS. If bit EXEN2 is set, bit EXF2 is also set at the same point when Timer2 is started with the same falling
edge/rising edge at pin T2EX, which is defined by bit EDGESEL. The capture will happen with the following
negative/positive transitions at pin T2EX, which is defined by bit EDGESEL.
When the capture operation is completed, bit EXF2 is set and can be used to generate an interrupt request.
describes the capture function of Timer 2.
Figure 117 Capture Mode
17.3.3
Count Clock
The count clock for the auto-reload mode is chosen by the bit C_T2 in register T2CON. If C_T2 = 0, a count clock
of
f
sys
/12 (if prescaler is disabled) is used for the count operation.
If C_T2 = 1, Timer 2 behaves as a counter that counts 1-to-0 transitions of input pin T2. The counter samples
pin T2 over 2
f
sys
cycles. If a 1 was detected during the first clock and a 0 was detected in the following clock,
then the counter increments by one. Therefore, the input levels should be stable for at least 1 clock.
TF 2
EXF2
THL2
RC2
T2EX
OR
EXEN2
Overflow
Timer 2
Interrupt
TR2
f
sys
PREN
T2PRE
/12
0
1
T2
C/T2=0
C/T2=1