12. Timer 0/1/2/3/4/5
A96G140/A96G148/A96A148 User’s manual
102
12.2
Timer 1
A 16-bit timer 1 consists of multiplexer, timer 1 A data register high/low, timer 1 B data register high/low
and timer 1 control register high/low (T1ADRH, T1ADRL, T1BDRH, T1BDRL, T1CRH, T1CRL).
Timer 1 operates in one of the following modes:
16-bit timer/counter mode
16-bit capture mode
16-bit PPG output mode (one-shot mode)
16-bit PPG output mode (repeat mode)
The timer/counter 1 uses an internal clock or an external clock (EC1) as an input clock source. The
clock sources are introduced below, and one is selected by clock selection logic which is controlled by
clock selection bits (T1CK[2:0]).
TIMER 1 clock source: fX/1, 2, 4, 8, 64, 512, 2048 and EC1
In capture mode, the data is captured into input capture data register (T1BDRH/T1BDRL) by EINT11.
Timer 1 results in the comparison between counter and data register through T1O port in timer/counter
mode. In addition, Timer 1 outputs PWM waveform through PWM1Oport in the PPG mode.
Table 16. TIMER 1 Operating Modes
T1EN
P1FSRL[5:4]
T1MS[1:0]
T1CK[2:0]
Timer 1
1
11
00
XXX
16 Bit Timer/Counter Mode
1
00
01
XXX
16 Bit Capture Mode
1
11
10
XXX
16 Bit PPG Mode(one-shot mode)
1
11
11
XXX
16 Bit PPG Mode(repeat mode)
12.2.1
16-bit timer/counter mode
16-bit timer/counter mode is selected by control registers, and the 16-bit timer/counter has counter
registers and data registers as shown in figure 37. The counter register is increased by internal or
external clock input. Timer 1 can use the input clock with one of 1, 2, 4, 8, 64, 512 and 2048 prescaler
division rates (T1CK[2:0]). When the value of T1CNTH, T1CNTL and the value of T1ADRH, T1ADRL
are identical to each other in Timer 1, a match signal is generated and the interrupt of Timer1 occurs.
The T1CNTH, T1CNTL value is automatically cleared by the match signal. It can be cleared by software
(T1CC) too.
The external clock (EC1) counts up the timer at the rising edge. If the EC1 is selected as a clock source
by T1CK[2:0], EC1 port should be set to the input port by P13IO bit.