Pulse Width Measurement Operations; Cr01N Capture Operation With Rising Edge Specified - NEC 78K0 User Manual

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

Advertisement

7.4.3

Pulse width measurement operations

It is possible to measure the pulse width of the signals input to the TI00n pin and TI01n pin using 16-bit timer
counter 0n (TM0n).
There are two measurement methods: measuring with TM0n used in free-running mode, and measuring by
restarting the timer in synchronization with the edge of the signal input to the TI00n pin.
When an interrupt occurs, read the valid value of the capture register, check the overflow flag, and then calculate
the necessary pulse width. Clear the overflow flag after checking it.
The capture operation is not performed until the signal pulse width is sampled in the count clock cycle selected by
prescaler mode register 0n (PRM0n) and the valid level of the TI00n or TI01n pin is detected twice, thus eliminating
noise with a short pulse width.
Figure 7-21. CR01n Capture Operation with Rising Edge Specified
Count clock
TM0n
TI00n
Rising edge detection
CR01n
INTTM01n
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC0n register (see Figures 7-22, 7-25, 7-27, and 7-29 for the set value).
<2> Set the count clock by using the PRM0n register.
<3> Set the TMC0n register to start the operation (see Figures 7-22, 7-25, 7-27, and 7-29 for the set value).
Caution To use two capture registers, set the TI00n and TI01n pins.
Remarks 1. For the setting of the TI00n (or TI01n) pin, see 7.3 (5) Port mode register 0 (PM0).
2. For how to enable the INTTM00n (or INTTM01n) interrupt, see CHAPTER 19
FUNCTIONS.
3. n = 0:
n = 0, 1:
CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01
N − 3
N − 2
µ
PD780143, 780144
µ
PD780146, 780148, 78F0148
User's Manual U15947EJ2V0UD
N − 1
N
*
N + 1
N
INTERRUPT
191

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

78kf1

Table of Contents