![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_186.png)
162
CHAPTER 6 INTERRUPTS
MB90560 series
6.10 Sample Programs for Interrupt Processing
This section contains sample programs for interrupt processing.
I
Sample programs for interrupt processing
G
Processing specifications
The following is a sample program for an interrupt that uses external interrupt 0 (INT0).
G
Sample coding
DDR1
ENIR
ENRR
ELVR
ICR00
STACK
EQU
EQU
EQU
EQU
EQU
SSEG
RW
RW
ENDS
000011H
030H
031H
032H
0B0H
;
;
;
;
;
;
Port 1 direction register
Interrupt/DTP enable register
Interrupt/DTP flag
Request level setting register
Interrupt control register
Stack
100
1
STACK_T
STACK
;---------Main program -------------------------------------------------------------------------------------------------------------
CODECSEG
START:
MOV
RP,#0
MOV
ILM, #07H
MOV
A, #!STACK_T
MOV
SSB, A
MOVW
A, #STACK_T
MOVW
SP, A
MOV
DDR1, #00000000B
OR
CCR, #40H
MOV
E:ICR00, #00H
MOV
I:ELVR, #00000001B
MOV
I:ENRR, #00H
MOV
I:ENRR, #01H
:
LOOP:
NOP
NOP
NOP
NOP
BRA
LOOP
;---------Interrupt program ----------------------------------------------------------------------------------------------
ED_INT1:
MOV
I:EIRR, #00H
NOP
NOP
NOP
NOP
NOP
NOP
RETI
CODE
ENDS
;--------Vector setting-----------------------------------------------------------------------------------------------------
VECT
CSEG
ABS=0FFH
ORG
0FFD0H
DSL
ED_INT1
ORG
0FFDCH
DSL
START
DB
00H
VECT
ENDS
END
START
;
;
;
General-purpose registers use the first bank.
Sets ILM in PS to level 7.
Sets system stack.
;
;
;
;
;
;
;
;
Sets stack pointer, then
Sets SSP because S flag = 1.
Sets P10/INT0 pin to input.
Sets I flag of CCR in PS, enables interrupts.
Sets interrupt level to 0 (highest priority).
Requests that INT0 be made level H.
Clears INT0 interrupt cause.
Enables INT0 input.
;
Dummy loop
;
Unconditional jump
;
Acceptance of new INT0 not allowed
;
Return from interrupt
;
Sets vector for interrupt #11 (0BH).
;
Sets reset vector.
;
Sets single-chip mode.