CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Preliminary User’s Manual U19014EJ1V0UD
166
(2) Measuring the pulse width by using one input signal of the TI000 pin (free-running mode)
Set the free-running timer mode (TMC003 and TMC002 = 01). The count value of TM00 is captured to CR000 in
the phase reverse to the valid edge detected on the TI000 pin. When the valid edge of the TI000 pin is detected,
the count value of TM00 is captured to CR010.
By this measurement method, values are stored in separate capture registers when a width from one edge to
another is measured. Therefore, the capture values do not have to be saved. By subtracting the value of one
capture register from that of another, a high-level width, low-level width, and cycle are calculated.
If an overflow occurs, the value becomes negative if one captured value is simply subtracted from another 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 (2)
•
TMC00 = 04H, PRM00 = 10H, CRC00 = 07H
FFFFH
TM00 register
0000H
Operable bits
(TMC003, TMC002)
Capture trigger input
(TI000)
Capture register
(CR000)
Capture register
(CR010)
Capture interrupt
(INTTM010)
Overflow flag
(OVF00)
Capture trigger input
(TI010)
Compare match interrupt
(INTTM000)
01
M
A
B
C
D
E
N
S
P
Q
00
0 write clear
0 write clear
0 write clear
0 write clear
0000H
L
L
A
B
C
D
E
0000H
M
N
S
P
Q
electronic components distributor