NEC V850ES/KE1+ User Manual page 280

32-bit single-chip microcontrollers
Table of Contents

Advertisement

A pulse width can be measured in the following three ways.
• Measuring the pulse width by using two input signals of the TI010 and TI011 pins (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI010 pin (free-running timer mode)
• Measuring the pulse width by using one input signal of the TI010 pin (clear & start mode entered by the TI010 pin
valid edge input)
Remarks 1. For the alternate-function pin settings, refer to Table 4-12 Settings When Port Pins Are Used for
Alternate Functions.
2. For enabling the INTTM010 and INTTM011 interrupts, refer to CHAPTER 17
EXCEPTION PROCESSING FUNCTION.
(1) Measuring the pulse width by using two input signals of the TI010 and TI011 pins (free-running timer
mode)
Set the free-running timer mode (the TMC01.TMC013 and TMC01.TMC012 bits = 01). When the valid edge of
the TI010 pin is detected, the count value of the TM01 register is captured to the CR011 register. When the valid
edge of the TI011 pin is detected, the count value of the TM01 register is captured to the CR010 register. Specify
detection of both the edges of the TI010 and TI011 pins.
By this measurement method, the previous count value is subtracted from the count value captured by the edge
of each input signal. Therefore, save the previously captured value to a separate register in advance.
If an overflow occurs, the value becomes negative if the previously captured value is simply subtracted from the
current captured value and, therefore, a borrow occurs (the PSW.CY bit is set to 1). If this happens, ignore CY
and take the calculated value as the pulse width. In addition, clear the TMC01.OVF01 bit to 0.
Figure 7-39. Timing Example of Pulse Width Measurement (1)
FFFFH
TM01 register
0000H
Operable bits
(TMC013, TMC012)
Capture trigger input
(TI010)
Capture register
0000H
(CR011)
Capture interrupt
(INTTM011)
Capture trigger input
(TI011)
Capture register
0000H
(CR010)
Capture interrupt
(INTTM010)
Overflow flag
(OVF01)
280
CHAPTER 7 16-BIT TIMER/EVENT COUNTER 0
• TMC01 = 04H, PRM01 = F0H, CRC01 = 05H
M
A
B
00
01
M
A
0 write clear
User's Manual U16896EJ2V0UD
N
S
C
N
B
C
0 write clear
0 write clear
INTERRUPT/
P
Q
D
E
S
Q
P
E
D
0 write clear

Advertisement

Table of Contents
loading

This manual is also suitable for:

?pd70f3302?pd703302?pd70f3302y?pd703302y

Table of Contents