;中断程序练习
ORG 00H
AJMP ZHU
ORG 03H
AJMP INT0A
ORG 13H
AJMP INT1A
ORG 30H
ZHU:MOV SP,#60H
SETB EX0
SETB EX1
SETB EA
SETB PX0
SETB PX1
SETB IT0
SETB IT1
MOV A,#01111111B
;------------------------
LIU:MOV P0,A
LCALL YAN
RL A
AJMP LIU
;-----------------------
INT0A:PUSH ACC
MOV A,#00H
CLR EX0
MOV R4,#8D
SS:MOV P0,#0F0H
LCALL YAN
MOV P0,#0FH
LCALL YAN
DJNZ R4,SS
POP ACC
SETB EX0
RETI
;-----------------------
INT1A:PUSH ACC
MOV A,#00H
CLR EX1
MOV R5,#8D
GG:MOV P0,#00H
LCALL YAN
MOV P0,#0FFH
LCALL YAN
DJNZ R5,GG
POP ACC
SETB EX1
RETI
;-----------------------
YAN:MOV R0,#10D
AA:MOV R1,#200D
BB:MOV R2,#200D
DJNZ R2,$
DJNZ R1,BB
DJNZ R0,AA
RET
;-----------------------
END |