CHAPTER 6 16-BIT TIMER/EVENT COUNTERS 00 AND 01
User’s Manual U16899EJ2V0UD
159
6.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 6-21. CR01n Capture Operation with Rising Edge Specified
Count clock
TM0n
TI00n
Rising edge detection
CR01n
INTTM01n
N
−
3
N
−
2
N
−
1
N
N + 1
N
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC0n register (see Figures 6-22, 6-25, 6-27, and 6-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 6-22, 6-25, 6-27, and 6-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 6.3 (5) Port mode register 0 (PM0).
2. For how to enable the INTTM00n (or INTTM01n) interrupt, see CHAPTER 17 INTERRUPT
FUNCTIONS.
3. n = 0:
µ
PD78F0132H
n = 0, 1:
µ
PD78F0133H, 78F0134H, 78F0136H, 78F0138H, 78F0138HD
Содержание MuPD78F0132H
Страница 2: ...User s Manual U16899EJ2V0UD 2 MEMO ...