85
TimerB
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 70. Timer Bi mode register in event counter mode
(2) Event counter mode
In this mode, the timer counts an external signal or an internal timer's overflow. (See Table 22.) Figure 70
shows the timer Bi mode register in event counter mode.
Table 22. Timer specifications in event counter mode
Item
Count source
Specification
External signals input to TBi
IN
pin
Effective edge of count source can be a rising edge, a falling edge, or falling
and rising edges as selected by software
Counts down
When the timer underflows, it reloads the reload register contents before
continuing counting
1/(n+1)
n : Set value
Count start flag is set (= 1)
Count start flag is reset (= 0)
I
nterrupt request generation timing
The timer underflows
TBi
IN
pin function
Count source input
Read from timer
Count value can be read out by reading timer Bi register
Write to timer
When counting stopped
When a value is written to timer Bi register, it is written to both reload register and counter
When counting in progress
When a value is written to timer Bi register, it is written to only reload register
(Transferred to counter at next reload time)
Count operation
Divide ratio
Count start condition
Count stop condition
T
7
i
m
6
e
r
5
B
i
4
m
o
3
d
e
2
r
e
1
0 1
g
i
0
s
t
e
r
S
T
y
m
i
M
b
o
R
l
(
A
d
6
d
t
r
o
e
s
0
s
3
W
0
h
X
e
X
n
r
0
e
s
0
e
0
2
t
B
i
=
0
t
o
2
)
0
3
9
B
1
9
D
1
6
0
0
B
i
t
n
a
m
e
F
u
n
c
t
i
o
n
B
i
T
t
s
y
O
m
D
b
0
o
l
W
R
b
b
b
b
b
b
b
b
O
s
p
e
e
e
r
c
a
t
t
b
i
o
i
n
t
m
o
d
e
l
0
1
:
E
v
e
n
t
c
o
u
n
t
e
r
m
o
d
e
b
1
b
0
T
M
O
D
1
M
M
R
0
C
b
o
i
u
(
n
N
t
o
p
t
e
o
l
1
a
r
i
t
y
s
e
l
e
c
t
t
)
M
R
2
M
R
1
M
R
3
In
I
n
c
In
C
v
v
u
a
a
l
i
d
a
t
e
i
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