English
Language : 

UPD784938 Datasheet, PDF (257/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 9 TIMER/EVENT COUNTER 0
Figure 9-38. Control Register Settings for Pulse Width Measurement
(a) Capture/compare control register 0 (CRC0)
7
6
5
4
3
2
1
0
CRC0 0
0
0
1
0
0
0
0
TM0 clearing disabled
TO0 & TO1 both toggle outputs
(b) External interrupt mode register 1 (INTM1)
7
6
5
4
3
2
1
0
INTM1 0
0
×
×
×
×
1
1
Both rising & falling edges
specified as INTP3 input valid edges
×: don’t care
Figure 9-39. Pulse Width Measurement Setting Procedure
Pulse width measurement
Set CRC0
CRC0 ← 10H
Set INTM1,
Set MK0L
; Specify both edges as
INTP3 input valid edges,
release interrupt masking
Initialize capture value buffer memory
X0 ← 0
Start count
CE0 ← 1
; Set 1 in bit 3 of TMC0
Enable interrupt
INTP3 interrupt
Preliminary User’s Manual U13987EJ1V0UM00
257