NEC 78K0S/KB1+ User Manual page 104

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0S/KB1+:
Table of Contents

Advertisement

(2) Measurement of two pulse widths with free-running counter
When 16-bit timer counter 00 (TM00) is operated in free-running mode, it is possible to simultaneously
measure the pulse widths of the two signals input to the TI000 pin and the TI010 pin.
Specify both the rising and falling edges as the valid edges of the TI000 and TI010 pins, by using bits 4 and 5
(ES000 and ES010) and bits 6 and 7 (ES100 and ES110) of PRM00.
When the valid edge specified by bits 4 and 5 (ES000 and ES010) of PRM00 is input to the TI000 pin, the
value of TM00 is taken into 16-bit timer capture/compare register 000 (CR010) and an interrupt request signal
(INTTM010) is set.
Also, when the valid edge specified by bits 6 and 7 (ES100 and ES110) of PRM00 is input to the TI010 pin, the
value of TM00 is taken into 16-bit timer capture/compare register 000 (CR000) and an interrupt request signal
(INTTM000) is set.
Sampling is performed using the count clock cycle selected by prescaler mode register 00 (PRM00), and a
capture operation is only performed when a valid level of the TI000 or TI010 pin is detected twice, thus
eliminating noise with a short pulse width.
Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.
Figure 6-21. Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter
7
6
CRC00
0
0
ES110
ES100
ES010
PRM00
1
1
7
6
TMC00
0
0
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
104
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(a) Capture/compare control register 00 (CRC00)
5
4
3
CRC002
CRC001
0
0
0
1
0
(b) Prescaler mode register 00 (PRM00)
ES000
3
2
PRM001
1
1
0
0
0/1
(c) 16-bit timer mode control register 00 (TMC00)
5
4
TMC003
TMC002
TMC001
0
0
0
1
0/1
User's Manual U17446EJ3V1UD
CRC000
1
CR000 used as capture register
Captures valid edge of TI010 pin to CR000.
CR010 used as capture register
PRM000
0/1
Selects count clock (setting "11" is prohibited).
Specifies both edges for pulse width detection.
Specifies both edges for pulse width detection.
OVF00
0
Free-running mode

Advertisement

Table of Contents
loading

Table of Contents