以下程序供参考,应该可以满足你的题意要求。
ORG 0000H
LJMP MAIN
ORG 0003H
LJMP ZD_INT0
ORG 0030H
MAIN: CLR P2.0
SETB EA
SETB EX0
CLR 00H
MOV DPTR,#TAB
LOOP1: MOV R7,#16
MOV R0,#00H
MOV A,R0
MOVC A,@A+DPTR
MOV P0,A
LOOP: ACALL DELAY
JBC 00H,MAIN
INC R0
MOV A,R0
MOVC A,@A+DPTR
MOV P0,A
DJNZ R7,LOOP
AJMP LOOP1
DELAY: MOV R6,#200
DELAY_1: MOV R5,#200
DELAY_2: NOP
NOP
NOP
NOP
JB 00H,DELAY_END
DJNZ R5,DELAY_2
DJNZ R6,DELAY_1
DELAY_END: RET
ZD_INT0: SETB 00H
RETI
TAB: DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H,080H,090H,088H,083H,0C6H,0A1H,086H,08EH
END
|