NEC V850E/MS1 UPD703100 User Manual page 276

32-/16-bit single-chip microcontrollers
Table of Contents

Advertisement

CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-14. Example of Pulse Width Measurement Setting Procedure
Figure 9-15. Example of Interrupt Request Processing Routine Which Calculates the Pulse Width
Caution If 2 or more overflows occur between the (n – 1)th capture and the nth capture, the pulse
width cannot be measured.
276
Initial pulse width
measurement setting
Setting the TMC11 register
Setting the INTM2 register
INTM2.ES121 ← 1
INTM2.ES120 ← 1
Setting the TUM11 register
TUM11.CMS112 ← 0
Initializing buffer memory
for capture data storage
X0 ← 0
Count start
TMC11.CE11 ← 1
Enabling interrupt
INTP112 interrupt
INTP112 interrupt processing
(both the rising and falling edges)
Calculating the pulse width
Yn = CC112 – X
tn = Yn × count clock period
Storing of nth time capture data
in buffer memory
Xn ← CC112
RETI
User's Manual U12688EJ4V0UM00
;
Specifies the count clock
;
Specifies both edges of the INTP112
input signal as active edges
;
Sets it as the capture register
;
Sets the CE11 bit (1)
;
Xn, Yn: Variables
n–1
; tn: Pulse width

Advertisement

Table of Contents
loading

Table of Contents