145
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
User’s Manual U15798EJ2V0UD
(3) Pulse width measurement with free-running counter and two capture registers
When 16-bit timer counter 0 (TM0) is operated in free-running mode (see register settings in
Figure 6-19
), it is
possible to measure the pulse width of the signal input to the TI00/P35 pin.
When the edge specified by bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0) is input to the
TI00/P35 pin, the value of TM0 is taken into 16-bit timer capture/compare register 01 (CR01) and an interrupt
request signal (INTTM01) is set.
Also, when the inverse edge of that of the capture operation is input into CR01, the value of TM0 is taken into
16-bit timer capture/compare register 00 (CR00).
Either of two edges can be selected—rising or falling—as the valid edge for the TI00/P35 pin specified by means
of bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0).
Sampling is performed at the interval selected by means of prescaler mode register 0 (PRM0), and a capture
operation is only performed when a valid level of the TI00/P35 pin is detected twice, thus eliminating noise with
a short pulse width.
Caution If the valid edge of the TI00/P35 pin is specified to be both the rising and falling edges, 16-bit
timer capture/compare register 00 (CR00) cannot perform the capture operation.
Figure 6-19. Control Register Settings for Pulse Width Measurement with Free-Running Counter and
Two Capture Registers
(a) 16-bit timer mode control register 0 (TMC0)
0
0
0
0
TMC03
0
TMC02
1
0
OVF0
0
TMC0
Free-running mode
(b) Capture/compare control register 0 (CRC0)
0
0
0
0
0
CRC02
1
CRC01
1
CRC00
1
CRC0
CR00 used as capture register
Captures to CR00 at edge reverse
to valid edge of TI00/P35.
CR01 used as capture register
Содержание mPD780344 Series
Страница 2: ...2 User s Manual U15798EJ2V0UD MEMO...