Timer_A Operation
12-6 Timer_A
Up Mode
The up mode is used if the timer period must be different from 0FFFFh counts.
The timer repeatedly counts up to the value of compare register TACCR0,
which defines the period, as shown in Figure 122. The number of timer
counts in the period is TACCR0+1. When the timer value equals TACCR0 the
timer restarts counting from zero. If up mode is selected when the timer value
is greater than TACCR0, the timer immediately restarts counting from zero.
Figure 122. Up Mode
0h
0FFFFh
TACCR0
The TACCR0 CCIFG interrupt flag is set when the timer counts to the TACCR0
value. The TAIFG interrupt flag is set when the timer counts from TACCR0 to
zero. Figure 123 shows the flag set cycle.
Figure 123. Up Mode Flag Setting
CCR01 CCR0 0h
Timer Clock
Timer
Set TAIFG
Set TACCR0 CCIFG
1h CCR01 CCR0 0h
Changing the Period Register TACCR0
When changing TACCR0 while the timer is running, 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.