proteus 51单片机 点灯不亮
proteus做了个程序灯亮不了ORG0000HAJMPSTARTORG0010HMAIN:MOVP1,#0FFHSTART:MOVP0,#0FFHJNBP0.0,KEY...
proteus
做了个程序 灯亮不了
ORG 0000H
AJMP START
ORG 0010H
MAIN: MOV P1,#0FFH
START: MOV P0,#0FFH
JNB P0.0,KEY0
SJMP START
KEY0: JNB P0.1, KEY1
JNB P0.2, KEY2
JNB P0.3, KEY3
JNB P0.4, KEY4
SJMP START
START1: MOV P0, #0FFH
ACALL DELAY
MOV A, P1
JNB ACC.1, KEY1
JNB ACC.2, KEY2
JNB ACC.3, KEY3
JNB ACC.4, KEY4
SJMP START1
KEY1: MOV R2,#08H
MOV R5,#0FEH
NEXT0: MOV A,P0
JNB ACC.3,KEY4
JNB ACC.4,KEY3
JB ACC.0,MAIN
MOV A,R5
MOV P1,A
ACALL DELAY
MOV A,R5
RL A
MOV R5,A
DJNZ R2,NEXT0
SJMP KEY1
KEY2: MOV A,P0
JB ACC.0,MAIN
JNB ACC.4, KEY3
JNB ACC.3, KEY4
MOV P1,#0DAH
ACALL DELAY2
MOV P1,#0C7H
ACALL DELAY2
MOV P1,#06EH
ACALL DELAY2
AJMP KEY2
LP1: JBC TF1, LP2
SJMP LP1
LP2: MOV TH1, #0B1H
MOV TL1, #0E0H
DJNZ R3, LP1
RET
KEY3: ACALL DELAY
MOV A,R6
ADD A,#3H
MOV R6,A
SJMP NEXT0
KEY4 : ACALL DELAY
MOV A,R6
MOV A,#3H
MOV R6,A
SJMP NEXT0
DELAY: MOV R3, #14H
MOV TMOD, #10H
MOV TH1, #0B1H
MOV TL1, #0E0H
SETB TR1
DELAY2:CALL DELAY
CALL DELAY
RET
END 展开
做了个程序 灯亮不了
ORG 0000H
AJMP START
ORG 0010H
MAIN: MOV P1,#0FFH
START: MOV P0,#0FFH
JNB P0.0,KEY0
SJMP START
KEY0: JNB P0.1, KEY1
JNB P0.2, KEY2
JNB P0.3, KEY3
JNB P0.4, KEY4
SJMP START
START1: MOV P0, #0FFH
ACALL DELAY
MOV A, P1
JNB ACC.1, KEY1
JNB ACC.2, KEY2
JNB ACC.3, KEY3
JNB ACC.4, KEY4
SJMP START1
KEY1: MOV R2,#08H
MOV R5,#0FEH
NEXT0: MOV A,P0
JNB ACC.3,KEY4
JNB ACC.4,KEY3
JB ACC.0,MAIN
MOV A,R5
MOV P1,A
ACALL DELAY
MOV A,R5
RL A
MOV R5,A
DJNZ R2,NEXT0
SJMP KEY1
KEY2: MOV A,P0
JB ACC.0,MAIN
JNB ACC.4, KEY3
JNB ACC.3, KEY4
MOV P1,#0DAH
ACALL DELAY2
MOV P1,#0C7H
ACALL DELAY2
MOV P1,#06EH
ACALL DELAY2
AJMP KEY2
LP1: JBC TF1, LP2
SJMP LP1
LP2: MOV TH1, #0B1H
MOV TL1, #0E0H
DJNZ R3, LP1
RET
KEY3: ACALL DELAY
MOV A,R6
ADD A,#3H
MOV R6,A
SJMP NEXT0
KEY4 : ACALL DELAY
MOV A,R6
MOV A,#3H
MOV R6,A
SJMP NEXT0
DELAY: MOV R3, #14H
MOV TMOD, #10H
MOV TH1, #0B1H
MOV TL1, #0E0H
SETB TR1
DELAY2:CALL DELAY
CALL DELAY
RET
END 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询