Timer A1
Mitsubishi microcomputers
M16C / 62A Group (80-pin)
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
70
Timer A
Figure 1.13.3 shows the block diagram of timer A. Figures 1.13.4 to 1.13.6 show the timer A-related registers.
Except in event counter mode, timers A0 through A4 all have the same function. However, in M16C/62 (80-
pin version) group, timer A1 and A2 are used for internal timer since timer A1 and A2 have no pin to perform
input/output. Use the timer Ai mode register (i = 0 to 4) bits 0 and 1 to choose the desired mode.
Timer A has the four operation modes listed as follows:
Timer mode: The timer counts an internal count source.
Event counter mode: The timer counts pulses from an external source or a timer over flow.
One-shot timer mode: The timer stops counting when the count reaches “0000
16
”.
Pulse width modulation (PWM) mode: The timer outputs pulses of a given width.
Figure 1.13.4. Timer A-related registers (1)
Count start flag
(Address 0380
16
)
TAi
Addresses
0387
16
0389
16
038B
16
038D
16
TAj
TAk
Timer A0
Timer A1
Timer A2
Timer A3
Timer A4 038F
16
0386
16
0388
16
038A
16
038C
16
038E
16
Timer A4
Timer A0
Timer A1
Timer A2
Timer A3
Timer A1
Timer A2
Timer A3
Timer A4
Timer A0
Always down count except
in event counter mode
Reload register (16)
Counter (16)
Low-order
8 bits
AAA
AAA
High-order
Clock source
selection
Timer
(gate function)
Timer
One shot
PWM
f
1
f
8
f
32
f
C32
External
trigger
TAi
IN
(i = 0 to 4)
TB2 overflow
Event counter
Clock selection
TAj overflow
(j = i – 1. Note, however, that j = 4 when i = 0)
Pulse output
Toggle flip-flop
TAi
OUT
(i = 0 to 4)
Data bus low-order bits
Data bus high-order bits
AA
Up/down flag
(Address 0384
16
)
Down count
TAk overflow
(k = i + 1. Note, however, that k = 0 when i = 4)
Polarity
selection
Note 1: The TA0
IN
pin (P7
1
) is shared with RxD
2
, SCL and the TB5
IN
pin, so be careful.
Note 2: TA1
IN
, TA1
OUT
, TA2
IN
and TA2
OUT
do not connect to outside. Do not set functions using these pins.
Timer Ai mode register
Symbol
TAiMR(i=0 to 4)
Address
When reset
00
16
0396
16
to 039A
16
Bit name
Function
Bit symbol
TMOD0
W
R
b7
b6
b5
b4
b3
b2
b1
b0
0 0 : Timer mode
0 1 : Event counter mode
1 0 : One-shot timer mode
1 1 : Pulse width modulation
(PWM) mode
b1 b0
TCK1
MR3
MR2
MR1
TMOD1
MR0
TCK0
Function varies with each operation mode
Count source select bit
(Function varies with each operation mode)
Operation mode select bit
AA
AA
AA
AA
AA
AA
Figure 1.13.3. Block diagram of timer A