CCR0-1
CCR0
CCR0-1
Timer Clock
Timer
Set TAxCTL TAIFG
Set TAxCCR0 CCIFG
CCR0-2
1h
0h
Up/Down
0h
TAxCCR0
0FFFFh
Timer_A Operation
648
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Timer_A
Time intervals can be produced with other modes as well, where
is used as the period register.
Their handling is more complex since the sum of the old TAxCCRn data and the new period can be higher
than the TAxCCR0 value. When the previous TAxCCRn value plus t
x
is greater than the TAxCCR0 data,
the TAxCCR0 value must be subtracted to obtain the correct time interval.
25.2.3.4 Up/Down Mode
The up/down mode is used if the timer period must be different from 0FFFFh counts, and if symmetrical
pulse generation is needed. The timer repeatedly counts up to the value of compare register
and back down to zero (see
). The period is twice the value in TAxCCR0.
Figure 25-7. Up/Down Mode
The count direction is latched. This allows the timer to be stopped and then restarted in the same direction
it was counting before it was stopped. If this is not desired, the TACLR bit must be set to clear the
direction. Setting TACLR also clears the TAR value and the clock divider counter logic (the divider setting
remains unchanged).
In up/down mode, the
CCIFG interrupt flag and the TAIFG interrupt flag are set only once
during a period, separated by one-half the timer period. The TAxCCR0 CCIFG interrupt flag is set when
the timer
counts
from TAxCCR0-1 to TAxCCR0, and TAIFG is set when the timer completes
counting
down from 0001h to 0000h.
shows the flag set cycle.
Figure 25-8. Up/Down Mode Flag Setting
25.2.3.4.1 Changing Period Register TAxCCR0
When changing
while the timer is running and counting in the down direction, the timer
continues its descent until it reaches zero. The new period takes effect after the counter counts down to
zero.
When the timer is counting in the up direction, and the new period is greater than or equal to the old
period or greater than the current count value, the timer counts up to the new period before counting
down.
When the timer is counting in the up direction and the new period is less than the current count value, the
timer begins counting down. However, one additional count may occur before the counter begins counting
down.