
127
CHAPTER 7 16-BIT TIMER/EVENT COUNTER
User
’
s Manual U15017EJ2V0UD
(2) Measurement of two pulse widths with free-running counter
The pulse widths of the two signals respectively input to the TI00/P20 and TIO51/P66 pins can be measured when
16-bit timer counter 0 (TM0) is used as a free-running counter (refer to the register settings in
Figure 7-12
).
When the edge specified by bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0) is input to the
TI00/P20 pin, the value of the TM0 is loaded 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 TIO51/P66 pin, the value of
TM0 is loaded to 16-bit capture/compare register 00 (CR00), and an external interrupt request signal (INTTM00)
is set.
For the edges of the TI00/P20 and TIO51/P66 pins, the rising, falling, or both rising and falling edges can be
specified.
Sampling is performed with the count clock selected by prescaler mode register 0 (PRM0), and the capture
operation is performed when the valid level of the TI00/P20 or TIO51/P66 pin is detected two times. Therefore,
noise with a short pulse width can be eliminated.
Fig
u
re 7-12. Control Register Settings 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)
0
0
0
0
TMC03
0
TMC02
1
0
OVF0
0
TMC0
Free-running mode
0
0
0
0
0
CRC02
1
CRC01
0
CRC00
1
CRC0
CR00 as capture register
Captures to CR00 at the valid edge of TIO51/P66 pin.
CR01 as capture register