English
Language : 

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