English
Language : 

M16C80 Datasheet, PDF (109/358 Pages) Renesas Technology Corp – RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/80 SERIES
M16C/80 Group
13. Timer A
(2) Event counter mode
In this mode, the timer counts an external signal or an internal timer’s overflow. Timers A0 and A1 can count a single-
phase external signal. Timers A2, A3, and A4 can count a single-phase and a two-phase external signal. Table 13.2
lists timer specifications when counting a single-phase external signal. Figure 13.6 shows the timer Ai mode register
in event counter mode. Table 13.3 lists timer specifications when counting a two-phase external signal.
Figure 13.7 shows the timer Ai mode register in event counter mode.
Table 13.2 Timer specifications in event counter mode (when not processing two-phase pulse signal)
Item
Specification
Count source
• External signals input to TAiIN pin (effective edge can be selected by software)
• TB2 overflows or underflows, TAj overflows or underflows
Count operation
• Up count or down count can be selected by external signal or software
• When the timer overflows or underflows, it reloads the reload register con
tents before continuing counting (Note)
Divide ratio
• 1/ (FFFF16 - n + 1) for up count
• 1/ (n + 1) for down count
n : Set value
Count start condition
Count start flag is set (= 1)
Count stop condition
Count start flag is reset (= 0)
Interrupt request generation timing The timer overflows or underflows
TAiIN pin function
Programmable I/O port or count source input
TAiOUT pin function
Programmable I/O port, pulse output, or up/down count select input (Setting by
the corresponding function select registers A and B)
Read from timer
Count value can be read out by reading timer Ai register
Write to timer
• When not counting
Value written to timer Ai register is written to both reload register and counter
• When counting
Value written to timer Ai register is written to only reload register
(Transferred to counter at next reload time)
Select function
• Free-run count function
Even when the timer overflows or underflows, the reload register content is
not reloaded to it
• Pulse output function
Each time the timer overflows or underflows, the TAiOUT pin’s polarity is reversed
Note: This does not apply when the free-run function is selected.
Timer Ai mode register
(When not using two-phase pulse signal processing)
b7 b6 b5 b4 b3 b2 b1 b0
0
01
Symbol
Address
When reset
TAiMR(i=0 to 4) 035616 to 035A16 00000X002
Bit symbol
Bit name
TMOD0
TMOD1
Operation mode select bit
Function
b1 b0
0 1 : Event counter mode
RW
MR0
MR1
This bit is invalid in M16C/80 series.
Port output control is set by the function select registers A and B.
––
Count polarity
select bit (Note 1)
0 : Counts external signal's falling edges
1 : Counts external signal's rising edges
MR2
MR3
Up/down switching
cause select bit
0 : Up/down flag's content
1 : TAiOUT pin's input signal (Note 2)
0 : (Set to “0” in event counter mode)
TCK0
TCK1
Count operation type
select bit
Two-phase pulse signal
processing operation
select bit
0 : Reload type
1 : Free-run type
When not using two-phase pulse signal
processing, set this bit to “0”
Note 1: This bit is valid when only counting an external signal.
Note 2: Set the corresponding function select register A to I/O port, and port direction
register to “0”.
Figure 13.6 Timer Ai mode register in event counter mode
Rev.1.00 Aug. 02, 2005 Page 98 of 329
REJ09B0187-0100