ORG 00H
START: MOV R4,#06H
MOV R0,#30H
CLE: MOV @R0,#00H
INC R0
DJNZ R4,CLE
L1: MOV R3,#0F7H
MOV R1,#00H
L2: MOV A,R3
MOV P2,A
MOV A,P2
MOV R4,A
SETB C
MOV R5,#03H
L3: RLC A
JNC KEY
INC R1
DJNZ R5,L3
CALL DISP
MOV A,R3
SETB C
RRC A
MOV R3,A
JC L2
JMP L1
KEY: MOV R7,#60
D2: MOV R6,#248
DJNZ R6,$
DJNZ R7,D2
D3: MOV A,P2
XRL A,R4
JZ D3
MOV A,R1
MOV DPTR,#TAB
MOVC A,@A+DPTR
XCH A,30H
XCH A,31H
XCH A,32H
XCH A,33H
XCH A,34H
XCH A,35H
CALL DISP
JMP L1
DISP: MOV A,35H
ADD A,#50H
MOV P0,A
CALL DELAY
MOV A,34H
ADD A,#40H
MOV P0,A
CALL DELAY
MOV A,33H
ADD A,#30H
MOV P0,A
CALL DELAY
MOV A,32H
ADD A,#20H
MOV P0,A
CALL DELAY
MOV A,31H
ADD A,#10H
MOV P0,A
CALL DELAY
MOV A,30H
ADD A,#00H
MOV P0,A
CALL DELAY
RET
DELAY: MOV R7,#06
D1: MOV R6,#248
DJNZ R6,$
DJNZ R7,D1
RET
ORG 300H
TAB: DB 03H,02H,01H
DB 06H,05H,04H
DB 09H,08H,07H
DB 0BH,00H,0AH
END
如果我要添加12个子程序,每个按件跳至相应的子程序,要怎样修改
在这里先谢谢各位了 |