NEC mPD78F0730 Preliminary User's Manual page 166

8-bit single-chip microcontroller
Table of Contents

Advertisement

(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.
TM00 register
Operable bits
(TMC003, TMC002)
Capture trigger input
Capture register
Capture register
Capture interrupt
(INTTM010)
Overflow flag
Capture trigger input
Compare match interrupt
(INTTM000)
166
Downloaded from
Elcodis.com
electronic components distributor
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-49. Timing Example of Pulse Width Measurement (2)
• TMC00 = 04H, PRM00 = 10H, CRC00 = 07H
FFFFH
M
A
0000H
00
01
(TI000)
0000H
(CR000)
0000H
(CR010)
(OVF00)
L
(TI010)
L
Preliminary User's Manual U19014EJ1V0UD
N
S
C
B
A
B
M
N
0 write clear
0 write clear
P
Q
D
E
C
D
S
P
0 write clear
0 write clear
E
Q

Advertisement

Table of Contents
loading

Table of Contents