Pulse Width Measurement Mode (Tqnmd2 To Tqnmd0 = 110) - NEC V850E/RS1 User Manual

32-/16-bit single-chip microcontroller with can interface
Table of Contents

Advertisement

8.5.8 Pulse width measurement mode (TQnMD2 to TQnMD0 = 110)

In the pulse width measurement mode, free-running counting is performed. The value of the 16-bit
counter is captured to capture register m (TQnCCRm) when both the rising and falling edges of the
TIQnm pin are detected, and the 16-bit counter is cleared to 0000H. In this way, the external input pulse
width can be measured.
To measure a long pulse width that exceeds the overflow of the 16-bit counter, use the overflow flag for
detection. A pulse width that causes overflow to occur twice or more cannot be measured. Adjust the
operating frequency of the 16-bit counter.
Caution:
Caution:
Remark:
Downloaded from
Elcodis.com
electronic components distributor
Chapter 8 16-Bit Timer/Event Counter Q
In the pulse width measurement mode, select the internal clock (TQnEEE of
TQnCTL1 register = 0) as a count clock.
Figure 8-30: Flowchart of Basic Operation in Pulse Width Measurement Mode
An external pulse can be input from any of TIQn0 to TIQn3 but only one of them can
be used. Specify that both the rising and falling edges are detected. Specify that the
input edge of an external pulse input that is not used is not detected.
n = 0 to 1, m = 0 to 3
User's Manual U16702EE3V2UD00
START
Initial setting
• Select clock.
(TQnCTL0: TQnCKS2 to TQnCKS0)
• Set pulse width measurement mode.
(TQnCTL1: TQnMD2 to TQnMD0 = 110)
• Set compare register.
(TQnOPT0: TQnCCS3 to TQnCCS0)
Note
Set edge detection of TIQnm
(TQnIS3 to TQnIS0)
Enable timer operation (TQnCE = 1).
Input rising edge of pulse to TIQnm.
Capture value to TQnCCRm.
Clear and start 16-bit counter.
Input falling edge of pulse to TIQnm.
Capture value to TQnCCRm.
Clear and start 16-bit counter.
.
349

Advertisement

Table of Contents
loading

Table of Contents