195
Timer A
M
i
t
s
u
M
S
b
i
s
3
M
h
0
I
C
i
m
2
R
i
1
O
c
r
8
C
o
c
o
G
M
m
p
r
P
u
t
u
T
e
r
p
R
s
o
U
S
I
N
G
L
E
-
C
H
I
P
1
6
-
B
I
T
C
M
O
O
E
Figure 2.2.15. Set-up procedure of event counter mode, free run type selected
Setting divide ratio
(b7
Can be set to 0000
16
to FFFF
16
b0
(b8)
b7
b0
Timer A0 register [Address 0387
16
, 0386
16
] TA0
Timer A1 register [Address 0389
16
, 0388
16
] TA1
Timer A2 register [Address 038B
16
, 038A
16
] TA2
Timer A3 register [Address 038D
16
, 038C
16
] TA3
Timer A4 register [Address 038F
16
, 038E
16
] TA4
Start count
Pulse output function select bit
0 : Pulse is not output (TA
iOUT
pin is a normal port pin)
Selecting event counter mode and functions
Timer Ai mode register (i=0 to 4) [Address 0396
16
to 039A
16
]
TAiMR (i=0 to 4)
Up/down switching cause select bit
0 : Up/down flag's content
Selection of event counter mode
Invalid in event counter mode (i = 0, 1)
Invalid when not using two-phase pulse signal processing(i = 2 to 4)
Count operation type select bit
1 : Free-run type
0 (Must always be “0” in event counter mode)
Count polarity select bit
0 : Counts external signal's falling edge
b7
b0
1
0
0
0
0
0
1
b7
0
b0
0
0
Setting up/down flag
Up/down flag [Address 0384
16
]
UDF
Timer A0 up/down flag
0 : Down count
Timer A1 up/down flag
0 : Down count
Timer A2 up/down flag
0 : Down count
Timer A3 up/down flag
0 : Down count
Timer A4 up/down flag
0 : Down count
When not using the 2-phase pulse signal processing function, be sure to set the select bit to “0”.
Setting count start flag
Count start flag [Address 0380
16
]
TABSR
Timer A0 count start flag
Timer A1 count start flag
Timer A2 count start flag
Timer A3 count start flag
Timer A4 count start flag
Setting one-shot start flag and trigger select register
b7
b0
One-shot start flag [Address 0382
16
]
ONSF
Timer A0 event/trigger select bit
0 0 :
Input on TA0
IN
is selected (Note)
b7
b0
Trigger select register [Address 0383
16
]
TRGSR
Timer A1 event/trigger select bit
0 0 :
Input on TA1
IN
is selected (Note)
Timer A2 event/trigger select bit
0 0 :
Input on TA2
IN
is selected (Note)
Timer A3 event/trigger select bit
0 0 :
Input on TA3
IN
is selected (Note)
Timer A4 event/trigger select bit
0 0 :
Input on TA4
IN
is selected (Note)
Note: Set the corresponding port direction register to “0”.