Pulse Width Measurement Operations - NEC mPD780344 Series User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

6.5.3 Pulse width measurement operations

It is possible to measure the pulse width of the signals input to the TI00/P35 pin and TI01/TO00/P34 pin using
16-bit timer counter 0 (TM0).
There are two measurement methods: measuring with TM0 used in free-running mode, and measuring by restarting
the timer in synchronization with the edge of the signal input to the TI00/P35 pin.
(1) Pulse width measurement with free-running counter and one capture register
When 16-bit timer counter 0 (TM0) is operated in free-running mode (see register settings in Figure 6-13), and
the edge specified by prescaler mode register 0 (PRM0) is input to the TI00/P35 pin, the value of TM0 is taken
into 16-bit timer capture/compare register 01 (CR01) and an external interrupt request signal (INTTM01) is set.
Any of three edges can be selected—rising, falling, or both edges—specified by means of bits 4 and 5 (ES00
and ES01) of PRM0.
Sampling is performed at the count clock selected by PRM0, and a capture operation is only performed when
a valid level of the TI00/P35 pin or TI01/TO00/P34 pin is detected twice, thus eliminating noise with a short pulse
width.
Figure 6-13. Control Register Settings for Pulse Width Measurement with Free-Running Counter
and One Capture Register
TMC0
CRC0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See Figure 6-3.
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(a) 16-bit timer mode control register 0 (TMC0)
TMC03
0
0
0
0
0
(b) Capture/compare control register 0 (CRC0)
0
0
0
0
0
User's Manual U15798EJ2V0UD
TMC02
OVF0
1
0
0
Free running mode
CRC02
CRC01
CRC00
1
0/1
0
CR00 used as compare register
CR01 used as capture register
141

Advertisement

Table of Contents
loading

Table of Contents