418
Chapter 11
16-bit Timer/Event Counter P (TMP)
Preliminary User’s Manual U17566EE1V2UM00
If an overflow occurs twice or more when the capture trigger interval is
long, the correct pulse width may not be obtained.
If the capture trigger interval is long, slow the count clock to lengthen one
cycle of the 16-bit counter, or use software. An example of how to use
software is shown next.
Figure 11-36
Example when capture trigger interval is long
Note
The overflow counter is set arbitrarily by software on the internal RAM.
<1> Read the TPnCCRm register (setting of the default value of the
TIPnm pin input).
<2> An overflow occurs. Increment the overflow counter and clear the
overflow flag to 0 in the overflow interrupt servicing.
<3> An overflow occurs a second time. Increment (+1) the overflow
counter and clear the overflow flag to 0 in the overflow interrupt
servicing.
<4> Read the TPnCCRm register.
Read the overflow counter.
When the overflow counter is “N”, the pulse width can be calculated
by (N
×
D
m1
– D
m0
).
In this example, the pulse width is ( D
m1
– D
m0
) because an
overflow occurs twice.
Clear the overflow counter (0H).
FFFFH
16-
b
it co
u
nter
0000H
TPnCE
b
it
TIPnm pin inp
u
t
TPnCCRm regi
s
ter
INTTPnOV
s
ign
a
l
TPnOVF
b
it
Overflow
co
u
nter
Note
D
m0
D
m1
1H
0H
2H
0H
D
m0
D
m1
<1> <2>
<
3
> <4>
1 cycle of 16-
b
it co
u
nter
P
u
l
s
e width
electronic components distributor