求一个51单片机的程序:一个按键控制led灯闪烁,就是按一下灯闪,再按灯就灭了
发布网友
发布时间:2022-04-25 20:00
我来回答
共1个回答
热心网友
时间:2023-10-14 19:09
LED BIT P1.0
KEY BIT P1.1
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
CLR 00H
MAIN1:
JB KEY,LOOP
JNB KEY,$
CPL 00H
LOOP:
JNB 00H,LOOP1
CPL LED
LCALL DELAY
SJMP MAIN1
LOOP1:
SETB LED
SJMP MAIN1
DELAY:
MOV R2,#200
DLY:
MOV R3,#250
DJNZ R3,$
DJNZ R2,DLY
RET
END