2个回答
展开全部
51汇编程序如下:
KEY EQU P3.2
LED EQU P1
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
CLR 00H
MOV A,#0FEH
LOOP:
JB P3.2,LOOP1
JNB P3.2,$
CPL 00H
LOOP1:
JB 00H,LOOP2
MOV LED,#0FFH
SJMP LOOP
LOOP2:
MOV P1,A
RL A
LCALL DELAY
SJMP LOOP
DELAY:
MOV R2,#200
DLY1:
MOV R3,#250
DJNZ R3,$
DJNZ R2,DLY1
RET
END
KEY EQU P3.2
LED EQU P1
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
CLR 00H
MOV A,#0FEH
LOOP:
JB P3.2,LOOP1
JNB P3.2,$
CPL 00H
LOOP1:
JB 00H,LOOP2
MOV LED,#0FFH
SJMP LOOP
LOOP2:
MOV P1,A
RL A
LCALL DELAY
SJMP LOOP
DELAY:
MOV R2,#200
DLY1:
MOV R3,#250
DJNZ R3,$
DJNZ R2,DLY1
RET
END
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询