English
Language : 

UPD784938 Datasheet, PDF (300/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 10 TIMER/EVENT COUNTER 1
Figure 10-28. Pulse Width Measurement Setting Procedure
Pulse width measurement
Set PRM1
Set CRC1
CRC1 ← 04H
Set INTM0
Set MK0L
; Specify both edges as INTP0
input valid edges, release
interrupt masking
Initialize capture value buffer memory
X0 ← 0
Start count
CE1 ← 1
; Set 1 in bit 3 of TMC1
Enable interrupts
INTP0 interrupt
Figure 10-29. Interrupt Request Servicing that Calculates Pulse Width
INTP0 interrupt
Calculate pulse width
Yn = CR11 – Xn
Store capture value in memory
Xn+1 ← CR11
RETI
300
Preliminary User’s Manual U13987EJ1V0UM00