NEC 78K0 Series User Manual page 231

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0 Series:
Table of Contents

Advertisement

A pulse width can be measured in the following three ways.
• Measuring the pulse width by using two input signals of the TI00n and TI01n pins (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI00n pin (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI00n pin (clear & start mode entered by the TI00n pin
valid edge input)
Remarks 1. For the setting of the I/O pins, see 7.3 (5) Port mode register 0 (PM0).
2. For how to enable the INTTM00n signal interrupt, see CHAPTER 19 INTERRUPT FUNCTIONS.
µ
3. n = 0:
PD78F0531, 78F0532, 78F0533
µ
n = 0, 1:
(1) Measuring the pulse width by using two input signals of the TI00n and TI01n pins (free-running timer
mode)
Set the free-running timer mode (TMC0n3 and TMC0n2 = 01). When the valid edge of the TI00n pin is detected,
the count value of TM0n is captured to CR01n. When the valid edge of the TI01n pin is detected, the count value
of TM0n is captured to CR00n. Specify detection of both the edges of the TI00n and TI01n 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 (OVF0n) of
16-bit timer mode control register 0n (TMC0n) to 0.
CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01
PD78F0534, 78F0535, 78F0536, 78F0537, 78F0537D
Preliminary User's Manual U17260EJ3V1UD
231

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents