汇编程序
ORG 0000H
AJMP MAIN
ORG 0003H //中断0
LJMP INT_0
ORG 0030H
MAIN:
SETB EA // 中断初始化
SETB EX0
LCALLL LED1
LCALL DELAY1
LJMP MAIN
LED1:
PUSH ACC
JB F0,NEXT1
MOV DPTR,#TAB1
AJMP LOOK
NXET1:
MOV DPTR,#TAB2
LOOK:
MOVC A,@A+DPTR//查表
MOV P2,A
POP ACC
INC A
CJNE A,#8,NEXT4
CLR A
NEXT4:
RET
DELAY1:MOVR7,#200
D1:MOV R6,#250
DJNZ R6,$
DJNZ R7,D1
RET
DELAY2:MOVR7,#40
D2:MOV R6,#250
DJNZ R6,$
DJNZ R7,D2
RET
INT_0:
ACALL DELAY2
CPL F0
RETI
TAB1:DB 7FH,3FH,1FH, 0FH, 07H, 03H, 01H, 00H
TAB2:DB 7EH,0BDH,0DBH,0E7H,0DBH,0BDH,7EH
END