55
T48C862-R3
4554A–4BMCU–02/03
Timer 3 consists of an 8-bit up-counter with two compare registers and one capture reg-
ister. The timer can be used as event counter, timer and signal generator. Its output can
be pro grammed as modul ator and d emodulat or for the serial interface. The two com-
pare registers enable various modes of signal generation, modulation and
demodulation. The counter can be driven by internal and external clock sources. For
external clock sources, it has a programmable edge-sensitive input which can be used
as counter input, capture signal input or trigger input. This timer input is synchronized
with SYSCL. Therefore, in the power-down mode SLEEP (CPU core -> sleep and OSC-
Stop -> ye s) , th is ti mer i npu t is s topp ed too. Th e coun ter is readable via its c aptu re r eg-
ister while it is running. In capture mode, the counter value can be captured by a
programmable capture event from the Timer 3 input or Timer 2 output.
A special feature of this timer is the trigger- and single-action mode. In trigger mode, the
counter starts counting triggered by the external signal at its input. In single-action
mode, the counter counts only one time up to the programmed compare match event.
These m odes are very usef ul for modulation , demodulati on, signal gene ration, signal
measurement and phase controlling. For phase controlling, the timer input is protected
against negative voltages and has zero-cross detection capability.
Timer 3 has a modulator output stage and input functions for demodulation. As modula-
tor it work s together with Time r 2 or the serial interfac e. When the shift regis ter is use d
for modulation the data shifted out of the register is encoded bitwise. In all demodulation
modes, the decoded data bits are shifted automatically into the shift register.
Timer/Counter Modes Timer 3 has 6 timer modes and 6 modulator/demodulator modes. The mode is set via
the Timer 3 Mode Register T3M.
In all the se mod es , the co mpa re regi st er and the co mpa re -m ode regi ste r bel ong ing to i t
define the counter value for a compare match and the action of a compare match. A
match of the current counter value with the content of one compare register triggers a
counter reset, a Timer 3 interrupt or the toggling of the output flip-flop. The compare
mode regis ters T3M1 an d T3M2 con tain the mask bits for enabl ing or di sabling these
actions.
The c ounter can also b e enabled to exec ute singl e action s with o ne or bo th compar e
regis ters. If thi s mode is set the corr esp ondin g c ompare m atch event is gene rate d on ly
once after the counter start.
Most of the timer modes use their compare registers alternately. After the start has been
activated, the first com parison is carried out via the compare register 1, the sec ond is
carried out via the compare register 2, the third is carried out again via the compare reg-
ister 1 and so on. This makes it easy to generate signals with constant per iods and
variable duty cycle or to generate signals with variable pulse and space widths.
If single-action mode is set for one compare register, the comparison is always carried
out after the first cycle via the other compare register.
The co unter can be started an d stoppe d via the control reg ister T3 C. This regi ster als o
contro ls the init ial leve l of the output bef ore star t. T3C contain s the interr upt mask for a
T3I input interrupt.
Via the Timer 3 clock-select register, the internal or external clock source can be
selecte d. This registe r sele cts al so the act ive edge of the exter nal inp ut. An edge at the
extern al in put T3I can gener ate also an i nterrup t if the T3E IM-b it is se t and the Ti mer 3
is stopped (T3R = 0) in the T3C-register.