
136
CHAPTER 6
16-BIT TIMER/EVENT COUNTER 0
User’s Manual U12790EJ2V0UD
(2) Measurement of two pulse widths with free-running counter
When 16-bit timer counter 0 (TM0) operates in the free-running mode (refer to Figure 6-16), the pulse widths
of the two signals input to the TI00/P32 and TI01/P33 pins can be simultaneously measured.
When the edge specified by bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0) is input to
the TI00/P32 pin, the value of TM0 is captured to 16-bit capture/compare register 01 (CR01), and an external
interrupt request signal (INTTM01) is set.
When the edge specified by bits 6 and 7 (ES10 and ES11) of PRM0 is input to the TI01/P33 pin, the value
of TM0 is captured to 16-bit capture/compare register 00 (CR00), and an external interrupt request signal
(INTTM00) is set.
The edges of the TI00/P32 and TI01/P33 pins are specified by bits 4 and 5 (ES00 and ES01), and bits 6 and
7 (ES10 and ES11) of PRM0, respectively. The rising, falling, or both the rising and falling edges can be
specified.
Because the value of TM0 is captured only after the valid level of the TI00 pin is detected twice by sampling
using the count clock cycle selected by prescaler mode register 0 (PRM0), noise with a short pulse width can
be eliminated.
Figure 6-16. Setting of Control Registers for Measurement of
Two Pulse Widths with Free-Running Counter
(a) 16-bit timer mode control register 0 (TMC0)
(b) Capture/compare control register 0 (CRC0)
Remark
0/1: When these bits are set to 1 or reset to 0, other functions can be used at the same time as
the pulse width measurement function. For details, refer to Figures 6-2 and 6-3.
0000
TMC03
0
TMC02
1
TMC01
0/1
OVF0
0
TMC0
Free-running mode
00000
CRC02
1
CRC01
0
CRC00
1
CRC0
CR00 is used as capture register.
Value of TM0 is captured to CR00 at valid edge of TI01/P33 pin.
CR01 is used as capture register.