User Manual
497
Rev. 1.1
2019-03-18
TLE984xQX
Microcontroller with LIN and Power Switches for Automotive Applications
Timer2 and Timer21
Timer 2 can be started by using TR2 bit by hardware or software. Timer 2 can be started by setting TR2 bit by
software. If bit T2RHEN is set, Timer 2 can be started by hardware. Bit T2REGS defines the event on pin T2EX:
falling edge or rising edge, that can set the run bit TR2 by hardware. Timer 2 can only be stopped by resetting
TR2 bit by software.
17.3
Functional Description
17.3.1
Auto-Reload Mode
The auto-reload mode is selected when the bit CP_RL2 in register T2CON is zero. In the auto-reload mode,
Timer 2 counts to an overflow value and then reloads its register contents with a 16-bit start value for a fresh
counting sequence. The overflow condition is indicated by setting bit TF2 in the T2CON register. This will then
generate an interrupt request to the core. The overflow flag TF2 must be cleared by software.
The auto-reload mode is further classified into two categories depending upon the DCEN control bit.
Table 271 Timer2 and Timer21 Modes
Mode
Description
Auto-reload
Up/Down Count Disabled
• Count up only
• Start counting from 16-Bit reload value, overflow at FFFF
H
• Reload event configurable for trigger by overflow condition only, or by
negative/positive edge at input pin T2EX as well
• Programmable reload value in register RC2
• Interrupt is generated with reload events.
Auto-reload
Up/Down Count Enabled
• Count up or down, direction determined by level at input pin T2EX
• No interrupt is generated
• Count up
– Start counting from 16-Bit reload value, overflow at FFFF
H
– Reload event triggered by overflow condition
– Programmable reload value in register RC2
• Count down
– Start counting from FFFF
H
, underflow at value defined in register RC2
– Reload event triggered by underflow condition
– Reload value fixed at FFFF
H
Channel capture
• Count up only
• Start counting from 0000
H
, overflow at FFFF
H
• Reload event triggered by overflow condition
• Reload value fixed at 0000
H
• Capture event triggered by falling/rising edge at pin T2EX
• Captured timer value stored in register RC2
• Interrupt is generate with reload or capture event