4 pulse width measurement operations – NEC uPD78056Y User Manual

Page 197

Advertising
background image

197

CHAPTER 8 16-BIT TIMER/EVENT COUNTER

TMC0

0

0/1

1

0

0

0

0

0

OVF0

TMC01

TMC02

TMC03

Free-Running Mode

CRC0

0

0/1

1

0

0

0

0

0

CRC00

CRC01

CRC02

CR00 set as compare register

CR01 set as capture register

8.5.4 Pulse width measurement operations

It is possible to measure the pulse width of the signals input to the TI00/P00 pin and TI01/P01 pin using the

16-bit timer register (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/P00 pin.

(1) Pulse width measurement with free-running counter and one capture register

When the 16-bit timer register (TM0) is operated in free-running mode (see register settings in Figure 8-17),

and the edge specified by external interrupt mode register 0 (INTM0) is input to the TI00/P00 pin, the value

of TM0 is taken into 16-bit capture/compare register 01 (CR01) and an external interrupt request signal (INTP0)

is set.

Any of three edge specifications can be selected—rising, falling, or both edges—by means of bits 2 and 3

(ES10 and ES11) of INTM0.

For valid edge detection, sampling is performed at the interval selected by means of the sampling clock

selection register (SCS), and a capture operation is only performed when a valid level is detected twice, thus

eliminating noise with a short pulse width.

Figure 8-17. Control Register Settings for Pulse Width Measurement with

Free-Running Counter and One Capture Register

(a) 16-bit timer mode control register (TMC0)

(b) Capture/compare control register 0 (CRC0)

Remark

0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width

measurement. See the description of the respective control registers for details.

Advertising