English
Language : 

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