![NEC mPD17120 Subseries User Manual Download Page 173](http://html.mh-extra.com/html/nec/mpd17120-subseries/mpd17120-subseries_user-manual_249259173.webp)
CHAPTER 14 INTERRUPT FUNCTIONS
158
14.4 PROGRAM EXAMPLE OF INTERRUPT
•
Program example of contermeasure for noise reduction of external interrupt (INT pin)
This example assumes the case of assigning INT pin for key input, etc.
When taking into the microcontroller data in kind of switch such as key input processing, it takes some time
for the level of input voltage to be stabilized after pushing the key or switch. Accordingly, the countermeasures
for removing the noise generated by key, etc. should be executed by software.
In the following program, after generating external interrupt, the signal from INT pin becomes effective after
confirming that there is not change in the level of INT pin two times in every 100
µ
s.
Example
WAITCNT
MEM
0.00H
; Counter of wait processing
KEYON
FLG
0.01H.3
; If key ON is determined (even just once), KEYON=1
SECOND
FLG
0.01H.0
; A flag describing key-checking for the second time.
ORG
0H
BR
JOB_INIT
ORG
3H
BR
INT_JOB
..
..
.
JOB_INIT:
MOV
WAITCNT, #0
; Clears RAM and the flag on RAM
CLR2
KEYON, SECOND ;
INITFLG
NOT IEGMD1, IEGMD0
; Rising edge is effective for the interrupt from INT pin
CLR1
IRQ
SET1
IP
EI
..
..
.
MAIN:
CALL
××
JOB
; arbitrary processing
CALL
××
JOB
; arbitrary processing
..
..
.
BR
MAIN
Summary of Contents for mPD17120 Subseries
Page 15: ... x MEMO ...
Page 23: ... MEMO 8 ...
Page 45: ... MEMO 30 ...
Page 49: ... MEMO 34 ...
Page 55: ... MEMO 40 ...
Page 93: ... MEMO 78 ...
Page 99: ... MEMO 84 ...
Page 102: ...CHAPTER 11 ARITHMETIC AND LOGIC UNIT 87 MEMO ...
Page 119: ... MEMO 104 ...
Page 175: ... MEMO 160 ...
Page 199: ... MEMO 184 ...
Page 265: ... MEMO 250 ...
Page 281: ...266 MEMO ...
Page 285: ... MEMO 270 ...
Page 289: ... MEMO 274 ...