程序如下
org 0000h
LJMP MAIN
MAIN:JNB P2.0,Z-M1
JNB P2.1,F-M1
SJMP MAIN
Z-M1:JNB P2.2,STOP
JNB P2.3,Y-B1
JNB P2.4,Z-S1
JNB P2.5,Z-B1
SJMP Z-M1
F-M1:JNB P2.2,STOP
JNB P2.3,F-BZ1
JNB P2.4,F-S1
JNB P2.5,F-B1
SJMP F-M1
Y-B1:MOV R0,#1
LJMP K2
Z-S1:MOV R0,#10
LJMP K2
Z-B1:MOV R0,#100
LJMP K2
K2: MOV R1,#01H
MOV 4,R1
K1: MOV P1,A
LCALL DELAY
CJNE A,#08H,K2
RL A
DJNZ R0,K1
LJMP MAIN
STOP:MOV P1,#00H
LCALL DELAY
LJMP MAIN
F-BZ1:MOV R0,#1
LJMP K4
F-S1:MOV R0,#10
LJMP K4
F-B1:MOV R0,#100
LJMP K4
K4: MOV R1,#08H
MOV A,R1
K3: MOV P1,A
LCALL DELAY
CJNE A,#01H,K4
RR A
DJNZ R0,K3
LJMP MAIN
DELAY:MOV R6,#250
D1: MOV R7,#250
D2: DJNZ R7,D2
DJNZ R6,D1
RET
END
最好能帮我生成HEX文件 谢谢了 |