English
Language : 

UPD78F0411GA-GAM-AX Datasheet, PDF (201/564 Pages) Renesas Technology Corp – Old Company Name in Catalogs and Other Documents
CHAPTER 6 16-BIT TIMER/EVENT COUNTERS 00
A pulse width can be measured in the following three ways.
• Measuring the pulse width by using two input signals of the TI000 and TI010 pins (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI000 pin (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI000 pin (clear & start mode entered by the TI000 pin
valid edge input)
Caution Do not select the TI000 valid edge as the count clock when measuring the pulse width.
Remarks 1. For the setting of the I/O pins, see 6.3 (6) Port mode register 3 (PM3).
2. For how to enable the INTTM000 signal interrupt, see CHAPTER 17 INTERRUPT FUNCTIONS.
(1) Measuring the pulse width by using two input signals of the TI000 and TI010 pins (free-running timer
mode)
Set the free-running timer mode (TMC003 and TMC002 = 01). When the valid edge of the TI000 pin is detected,
the count value of TM00 is captured to CR010. When the valid edge of the TI010 pin is detected, the count value
of TM00 is captured to CR000. Specify detection of both the edges of the TI000 and TI010 pins.
By this measurement method, the previous count value is subtracted from the count value captured by the edge
of each input signal. Therefore, save the previously captured value to a separate register in advance.
If an overflow occurs, the value becomes negative if the previously captured value is simply subtracted from the
current captured value and, therefore, a borrow occurs (bit 0 (CY) of the program status word (PSW) is set to 1).
If this happens, ignore CY and take the calculated value as the pulse width. In addition, clear bit 0 (OVF00) of
16-bit timer mode control register 00 (TMC00) to 0.
Figure 6-49. Timing Example of Pulse Width Measurement (1)
• TMC00 = 04H, PRM00 = F0H, CRC00 = 05H
FFFFH
TM00 register
0000H
Operable bits
(TMC003, TMC002)
00
Capture trigger input
(TI000)
M
A
01
Capture register
(CR010) 0000H
Capture interrupt
(INTTM010)
Capture trigger input
(TI010)
Capture register
(CR000)
0000H
A
Capture interrupt
(INTTM000)
Overflow flag
(OVF00)
N
B
S
C
P
D
Q
E
M
N
S
P
Q
B
C
D
E
0 write clear 0 write clear 0 write clear
0 write clear
User’s Manual U18698EJ1V0UD
199