用汇编语言给51单片机编程四种流水灯 10
1个回答
展开全部
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
MOV 30H,#0FEH
MOV 31H,01H
MOV 32H,#55H
LOOP:
MOV A,P1
ANL A,#03H
JNZ LOOP1
MOV A,30H
MOV P0,A
RL A
MOV 30H,A
LCALL DELAY
SJMP LOOP
LOOP1:
DEC A
JNZ LOOP2
MOV A,30H
MOV P0,A
RR A
MOV 30H,A
LCALL DELAY
SJMP LOOP
LOOP2:
DEC A
JNZ LOOP3
MOV A,31H
MOV P0,A
CJNE A,#0FFH,LOOP21
MOV A,#01H
SJMP LOOP22
LOOP21:
SETB C
RLC A
LOOP22:
MOV 31H,A
LCALL DELAY
SJMP LOOP
LOOP3:
MOV A,32H
MOV P0,A
CPL A
MOV 32H,A
LCALL DELAY
LJMP LOOP
END
LJMP MAIN
ORG 0030H
MAIN:
MOV 30H,#0FEH
MOV 31H,01H
MOV 32H,#55H
LOOP:
MOV A,P1
ANL A,#03H
JNZ LOOP1
MOV A,30H
MOV P0,A
RL A
MOV 30H,A
LCALL DELAY
SJMP LOOP
LOOP1:
DEC A
JNZ LOOP2
MOV A,30H
MOV P0,A
RR A
MOV 30H,A
LCALL DELAY
SJMP LOOP
LOOP2:
DEC A
JNZ LOOP3
MOV A,31H
MOV P0,A
CJNE A,#0FFH,LOOP21
MOV A,#01H
SJMP LOOP22
LOOP21:
SETB C
RLC A
LOOP22:
MOV 31H,A
LCALL DELAY
SJMP LOOP
LOOP3:
MOV A,32H
MOV P0,A
CPL A
MOV 32H,A
LCALL DELAY
LJMP LOOP
END
追问
求注释 这个有开关嘛?
追答
开关是P1.0和P1.1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询