4 timer—up/down mode, Figure 10–12. timer up/down mode – Texas Instruments MSP430x1xx User Manual
Page 150
Timer Modes
10-10
10.3.3.1 Timer—Use of the Continuous Mode
The continuous mode can be used to generate time intervals for the
application software. Each time an interval is completed, an interrupt can be
generated. In the interrupt service routine of this event, the time until the next
event is added to capture/compare register CCRx as shown in Figure 10–11.
Up to five independent time events can be generated using all five
capture/compare blocks.
Figure 10–11.Output Unit in Continuous Mode for Time Intervals
∆
t
CCR0a
CCR0b
CCR0c
CCR0d
CCR0e
CCR0f
CCR0h
CCR0i
CCR0j
CCR0k
CCR0l
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
∆
t
0FFFFh
0h
Interrupt Events
CCR0g
CCR0m
Time intervals can be produced with other modes as well, where CCR0 is used
as the period register. Their handling is more complex since the sum of the old
CCRx data and the new period can be higher than the CCR0 value. When the
sum CCRxold plus
∆
t is greater than the CCR0 data, the CCR0 value must be
subtracted to obtain the correct time interval. The period is twice the value in
the CCR0 register.
10.3.4 Timer—Up/Down Mode
The up/down mode is used if the timer period must be different from the 65,536
clock cycles, and if symmetrical pulse waveform generation is needed. In
up/down mode, the timer counts up to the content of compare register CCR0,
then back down to zero, as shown in Figure 10–12. The period is twice the
value in the CCR0 register.
Figure 10–12. Timer Up/Down Mode
0h
CCR0