English
Language : 

UPD784938 Datasheet, PDF (287/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 10 TIMER/EVENT COUNTER 1
Figure 10-12. 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?
NO
A ← A+1
YES
YES
PIF0 = 1?
NO
; Check TM1 value
If 0, check interrupt
request flag
; Check PIF0 contents
If 1, there is a valid edge
End
; Number of input valid edges is set in A register
Preliminary User’s Manual U13987EJ1V0UM00
287