CHAPTER 7 16-BIT TIMER/EVENT COUNTER 0
User’s Manual U16896EJ2V0UD
281
(2) Measuring the pulse width by using one input signal of the TI010 pin (free-running timer mode)
Set the free-running timer mode (the TMC01.TMC013 and TMC01.TMC012 bits = 01). The count value of the
TM01 register is captured to the CR010 register in the phase reverse to the valid edge detected on the TI010 pin.
When the valid edge of the TI010 pin is detected, the count value of the TM01 register is captured to the CR011
register.
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 (the PSW.CY bit is set to 1). If this happens, ignore CY and take the calculated value
as the pulse width. In addition, clear the TMC01.OVF01 bit to 0.
Figure 7-40. Timing Example of Pulse Width Measurement (2)
•
TMC01 = 04H, PRM01 = 10H, CRC01 = 07H
FFFFH
TM01 register
0000H
Operable bits
(TMC013, TMC012)
Capture trigger input
(TI010)
Capture register
(CR010)
Capture register
(CR011)
Capture interrupt
(INTTM011)
Overflow flag
(OVF01)
Capture trigger input
(TI011)
Capture interrupt
(INTTM010)
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
Содержание V850ES/KE1+
Страница 2: ...User s Manual U16896EJ2V0UD 2 MEMO...