A96G140/A96G148/A96A148 User’s manual
12. Timer 0/1/2/3/4/5
141
12.6
Timer 5
A 16-bit timer 5 consists of a multiplexer, timer 5 A data high/low register, timer 5 B data high/low
register and timer 5 control high/low register (T5ADRH, T5ADRL, T5BDRH, T5BDRL, T5CRH, and
T5CRL).
Timer 5 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 5 can be a divided clock of a system clock selected from prescaler output. The clock
source is selected by a clock selection logic controlled by clock selection bits (T5CK[2:0]).
TIMER 5 clock source: fX/1, fX/2, fX/4, fX/8, fX/32, fX/128, fX/512 and HSIRC
In capture mode, data is captured into input capture data registers (T5BDRH/T5BDRL) by EINT5. In
timer/counter mode, whenever counter value is equal to T5ADRH/L, T5O port toggles. In addition, the
TIMER 5 outputs PWM waveform to PWM5O port in the PPG mode.
Table 24. TIMER 5 Operating Modes
T5EN
P0FSRH[5:4]
T5MS[1:0]
T5CK[2:0]
Timer 5
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.6.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 68. The counter register is increased by internal clock
input.
Timer 5 can use the input clock with one of 1, 2, 4, 8, 32, 128, 512 and High Frequency Internal Oscillator
(HSIRC) prescaler division rates (T5CK[2:0]). When the values of T5CNTH/T5CNTL and
T5ADRH/T5ADRL are identical to each other in timer 5, a match signal is generated and the interrupt
of Timer 5 occurs. The T5CNTH/T5CNTL values are automatically cleared by the match signal. It can
be cleared by software (T5CC) too.