UPD78F0838 Renesas Electronics Corporation., UPD78F0838 Datasheet - Page 299

no-image

UPD78F0838

Manufacturer Part Number
UPD78F0838
Description
8-bit Single-chip Microcontrollers
Manufacturer
Renesas Electronics Corporation.
Datasheet
(c) Processing of overflow when two capture registers are used
Care must be exercised in processing the overflow flag when two capture registers are used. First, an
example of incorrect processing is shown below.
The following problem may occur when two pulse widths are measured in the free-running timer mode.
<1> Read the TPnCCR0 register (setting of the default value of the TIOPn0 pin input).
<2> Read the TPnCCR1 register (setting of the default value of the TIOPn1 pin input).
<3> Read the TPnCCR0 register.
<4> Read the TPnCCR1 register.
When two capture registers are used, and if the overflow flag is cleared to 0 by one capture register, the
other capture register may not obtain the correct pulse width.
Use software when using two capture registers. An example of how to use software is shown below.
TPnCCR0 register
TPnCCR1 register
INTTPnOV signal
TIOPn0 pin input
TIOPn1 pin input
Read the overflow flag. If the overflow flag is 1, clear it to 0.
Because the overflow flag is 1, the pulse width can be calculated by (10000H + D
Read the overflow flag. Because the flag is cleared in <3>, 0 is read.
Because the overflow flag is 0, the pulse width can be calculated by (D
16-bit counter
TPnOVF bit
Example of incorrect processing when two capture registers are used
TPnCE bit
FFFFH
0000H
CHAPTER 6 16-BIT TIMER/EVENT COUNTER P (TMP)
Preliminary User’s Manual U19748EJ1V0UD
D
00
<1>
D
10
<2>
D
00
D
D
01
10
<3>
D
11
<4>
11
D
01
D
10
D
) (incorrect).
11
01
D
00
).
297

Related parts for UPD78F0838