
CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 TO 05
User
’
s Manual U15862EJ3V0UD
331
(3) Pulse width measurement with free-running counter and two capture registers
When 16-bit timer counter 0n (TM0n) is used as a free-running counter (refer to
Figure 7-14
), the pulse width
of the signal input to the TI0n0 pin can be measured.
When the edge specified by bits 4 and 5 (ESn00 and ESn01) of prescaler mode register 0n (PRM0n) is input
to the TI0n0 pin, the value of the TM0n register is loaded to 16-bit timer capture/compare register 0n1 (CR0n1)
and an external interrupt request signal (INTTM0n1) is set.
The value of the TM0n register is also loaded to 16-bit timer capture/compare register 0n0 (CR0n0) when an
edge inverse to the one that triggers capturing to the CR0n1 register is input.
The edge of the TI0n0 pin is specified by bits 4 and 5 (ESn00 and ESn01) of the PRM0n register. The rising or
falling edge can be specified.
The valid edge of the TI0n0 pin is detected through sampling at a count clock cycle selected with the PRM0n
register, and the capture operation is not performed until the valid edge is detected twice. As a result, noise
with a short pulse width can be eliminated.
Caution
If the valid edge of the TI0n0 pin is specified to be both the rising and falling edges, the
CR0n0 register cannot perform capture operation.
Figure 7-14. Control Register Settings for Pulse Width Measurement
with Free-Running Counter and Two Capture Registers
(a) 16-bit timer mode control register 0n (TMC0n)
0
TMC0n
0
0
0
0
1
0/1
0
TMC0n3 TMC0n2 TMC0n1
OVF0n
Free-running mode
(b) Capture/compare control register 0n (CRC0n)
0
CRC0n
0
0
0
0
1
1
1
CRC0n2 CRC0n1 CRC0n0
CR0n0 used as capture register
Captures to CR0n0 at edge
inverse to valid edge of TI0n0 pin
CR0n1 used as capture register
Remarks 1.
0/1: When these bits are reset to 0 or set to 1, other functions can be used together with the pulse
width measurement function. For details, refer to
7.3 (1) 16-bit timer mode control register 0n
(TMC0n)
.
2.
n = 0 to 5