Texas Instruments MSP430x1xx Computer Hardware User Manual


 
Timer_B Operation
12-6
Timer_B
Up Mode
The up mode is used if the timer period must be different from TBR
(max)
counts.
The timer repeatedly counts up to the value of compare latch TBCL0, which
defines the period, as shown in Figure 12−2. The number of timer counts in
the period is TBCL0+1. When the timer value equals TBCL0 the timer restarts
counting from zero. If up mode is selected when the timer value is greater than
TBCL0, the timer immediately restarts counting from zero.
Figure 12−2. Up Mode
0h
TBR
(max)
TBCL0
The TBCCR0 CCIFG interrupt flag is set when the timer counts to the TBCL0
value. The TBIFG interrupt flag is set when the timer counts from TBCL0 to
zero. Figure 11−3 shows the flag set cycle.
Figure 12−3. Up Mode Flag Setting
TBCL0−1 TBCL0 0h
Timer Clock
Timer
Set TBIFG
Set TBCCR0 CCIFG
1h TBCL0−1 TBCL0 0h
Changing the Period Register TBCL0
When changing TBCL0 while the timer is running and when the TBCL0 load
mode is immediate, if 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.
If the new period is less than the current count value, the timer rolls to zero.
However, one additional count may occur before the counter rolls to zero.