English
Language : 

UPD784938 Datasheet, PDF (303/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 10 TIMER/EVENT COUNTER 1
Figure 10-32. To Distinguish whether One or No Valid Edge has been Input with External Event Counter
(a) Processing when count is started
Start count
Clear INTP0
interrupt request flag
PIF0 ← 0
; Clear PIF0 to 0
Start count
CE1 ← 1
; Set CE1 to 1
End
(b) Processing when count value is read
Count value
read
Read TM1 contents
A ← TM1
A = 0?
YES
NO
YES
A ← A+1
PIF0 = 1?
NO
; Check TM1 value.
If 0, check interrupt
request flag.
; Check PIF0 contents.
If 1, valid edge is input.
End
; Number of input valid edges is set to A register
Preliminary User’s Manual U13987EJ1V0UM00
303