415
16-bit Timer/Event Counter P (TMP)
Chapter 11
Preliminary User’s Manual U17566EE1V2UM00
Figure 11-33
Example when two capture registers are used (using overflow interrupt)
Note
The TPnOVF0 and TPnOVF1 flags are set on the internal RAM by software.
<1> Read the TPnCCR0 register (setting of the default value of the TIPn0
pin input).
<2> Read the TPnCCR1 register (setting of the default value of the TIPn1
pin input).
<3> An overflow occurs. Set the TPnOVF0 and TPnOVF1 flags to 1 in the
overflow interrupt servicing, and clear the overflow flag to 0.
<4> Read the TPnCCR0 register.
Read the TPnOVF0 flag. If the TPnOVF0 flag is 1, clear it to 0.
Because the TPnOVF0 flag is 1, the pulse width can be calculated by
( D
01
-
D
00
).
<5> Read the TPnCCR1 register.
Read the TPnOVF1 flag. If the TPnOVF1 flag is 1, clear it to 0 (the
TPnOVF0 flag is cleared in <4>, and the TPnOVF1 flag remains 1).
Because the TPnOVF1 flag is 1, the pulse width can be calculated by
( D
11
-
D
10
) (correct).
<6> Same as <3>
FFFFH
16-
b
it co
u
nter
0000H
TPnCE
b
it
INTTPnOV
s
ign
a
l
TPnOVF
b
it
TPnOVF0 fl
a
g
Note
TIPn0 pin inp
u
t
TPnCCR0 regi
s
ter
TPnOVF1 fl
a
g
Note
TIPn1 pin inp
u
t
TPnCCR1 regi
s
ter
D
10
D
11
D
00
D
01
D
10
<1>
<2>
<5> <6>
<
3
>
<4>
D
00
D
11
D
01
electronic components distributor