Rev.2.00 Nov 28, 2005 page 115 of 378
REJ09B0124-0200
M16C/6N Group (M16C/6NK, M16C/6NM) 13. Timers
Under development
This document is under development and its contents are subject to change.
13.1 Timer A
Figure 13.3 shows a block diagram of the timer A. Figures 13.4 to 13.6 show the timer A-related registers.
The timer A supports the following four modes. Except in event counter mode, timers A0 to A4 all have the
same function. Use the TMOD1 to TMOD0 bits in the TAiMR register (i = 0 to 4) to select the desired mode.
• Timer mode: The timer counts an internal count source.
• Event counter mode: The timer counts pulses from an external device or overflows and
underflows of other timers.
• One-shot timer mode: The timer outputs a pulse only once before it reaches the minimum count “0000h.”
• Pulse width modulation mode: The timer outputs pulses in a given width successively.
TCK1 to TCK0, TMOD1 to TMOD0, MR2 to MR1: Bits in TAiMR register
TAiTGH to TAiTGL: Bits in ONSF register If i = 0, bits in TRGSR register if i = 1 to 4
TAiS: Bit in TABSR register
TAiUD: Bit in UDF register
i = 0 to 4
j = i - 1except j = 4 when i = 0
k = i + 1 except k = 0 when i = 4
NOTE:
1.Overflow or underflow
00
01
10
11
TCK1 to TCK0
Select Clock source
TAiIN
Select clock
f1 or f2
f8
f32
fC32
Timer
: TMOD1 to TMOD0 = 00, MR2 = 0
One shot
: TMOD1 to TMOD0 = 10
Pulse width modulation : TMOD1 to TMOD0 = 11
Timer (gate function) : TMOD1 to TMOD0 = 00, MR2 = 1
Event counter : TMOD1 to TMOD0 = 01
TMOD1 to TMOD0,
MR2
00
01
10
11
TAiTGH to TAiTGL
TB2 overflow (1)
TAj overflow (1)
TAk overflow (1)
00
10
11
01
TMOD1 to TMOD0
Polarity
selection
To external trigger circuit
Pulse output
Decrement
0
1
MR2
TAiS
TAiUD
TAiOUT
High-order Bits of Data Bus
Low-order Bits of Data Bus
Reload Register
Low-order
8 bits
High-order
8 bits
Counter
Increment/Decrement
Always counts down except
in event counter mode
Toggle Flip-Flop
TAi Addresses TAj TAk
Timer A0 0387h-0386h Timer A4 Timer A1
Timer A1 0389h-0388h Timer A0 Timer A2
Timer A2 038Bh-038Ah Timer A1 Timer A3
Timer A3 038Dh-038Ch Timer A2 Timer A4
Timer A4 038Fh- 038Eh Timer A3 Timer A0
Figure 13.3 Timer A Block Diagram