Pulse Width Measurement - NEC V850/SB1 User Manual

32-bit single-chip microcontroller
Table of Contents

Advertisement

7.2.3 Pulse width measurement

16-bit timer register n (TMn) can be used to measure the pulse widths of the signals input to the TIn0 and TIn1
pins.
Measurement can be carried out with TMn used as a free-running counter or by restarting the timer in
synchronization with the edge of the signal input to the TIn0 pin.
(1) Pulse width measurement with free-running counter and one capture register
If the edge specified by prescaler mode register n0 (PRMn0) is input to the TIn0 pin when 16-bit timer register n
(TMn) is used as a free-running counter (refer to Figure 7-8), the value of TMn is loaded to 16-bit
capture/compare register n1 (CRn1), and an external interrupt request signal (INTTMn1) is set.
The edge is specified by using bits 6 and 7 (ESn10 and ESn11) of prescaler mode register n0 (PRMn0). The
rising edge, falling edge, or both the rising and falling edges can be selected.
The valid edge is detected by sampling at the count clock cycle selected by prescaler mode register n0, n1
(PRMn0, PRMn1), and a capture operation is not performed until the valid level is detected two times. Therefore,
noise with a short pulse width can be eliminated.
Figure 7-8. Control Register Settings for Pulse Width Measurement with
TMCn
0
0
CRCn
0
0
Remark 0/1: When these bits are reset to 0 or set to 1, other functions can be used along with the pulse
width measurement function. For details, refer to 7.1.4 (1) 16-bit timer mode control registers
0, 1 (TMC0, TMC1) and 7.1.4 (2) Capture/compare control registers 0, 1 (CRC0, CRC1).
CHAPTER 7
TIMER/COUNTER FUNCTION
Free-Running Counter and One Capture Register
(a) 16-bit timer mode control registers 0, 1 (TMC0, TMC1)
TMCn3
0
0
(b) Capture/compare control registers 0, 1 (CRC0, CRC1)
0
0
User's Manual U13850EJ6V0UD
TMCn2
TMCn1
0
1
0/1
CRCn2
CRCn1
0
1
0/1
OVFn
0
Free-running mode
CRCn0
0
CRn0 used as compare
register
CRn1 used as capture
register
215

Advertisement

Table of Contents
loading

This manual is also suitable for:

V850/sb2

Table of Contents