这个程序是用Keil uVision3软件运行的51单片机。里面有多处语法错误,求高手帮忙改一下啊! 10
ORG;0000H;AJMP;MAIN;ORG;0100H;MAIN;MOV,P0,#0FFH;MOV,P2,#0FFH;CLR,P0.0LCALLDELAY1SETBP...
ORG;0000H;
AJMP ; MAIN;
ORG ;0100H;
MAIN;
MOV,P0,#0FFH;
MOV,P2,#0FFH;
CLR,P0.0
LCALL DELAY1
SETB P0.0
CLR P0.1
LCALL DELAY1
SETB P0.1
CLR P0.2
LCALL DELAY1
SETB P0.2
CLR P0.3
LCALL DELAY1
SETB P0.3
CLR P0.4
LCALL DELAY1
SETB P0.4
CLR P0.5
LCALL DELAY1
SETB P0.5
CLR P0.6
LCALL DELAY1
SETB P0.6
CLR P0.7
LCALL DELAY1
SETB P0.7
CLR P2.0
LCALL DELAY1
SETB P2.0
MOV P0,#OFFH
CLR P0.0,P0.3,P0.6
LCALL DELAY2
SETB P0.0,P0.3,P0.6
CLR P0.1,P0.4,P0.7
LCALL DELAY2
SETB P0.1,P0.4,P0.7
CLR P0.2,P0.5,P2.0
LCALL DELAY2
SETB P0.2,P0.5,P2.0
AJMP MAIN
DELAY1:
time800ms: mov r5,#04h;
time800ms_1;:mov ; r6,#0f4h;
time800ms_2;:mov ; r7,#0ffh;
djnz ; r7,$
djnz ; r6,time800ms_2
djnz ; r5,time800ms_1
ret
DELAY2:
time1.6s;: mov ;r5,#04h;
time1;.6s_1;:mov ;r6,#0f4h;
time1;.6s_2;:mov ;r7,#0ffh;
djnz ;r7,$
djnz ;r6,time1.6s_2
djnz ;r5,time1.6s_1
ret
END 展开
AJMP ; MAIN;
ORG ;0100H;
MAIN;
MOV,P0,#0FFH;
MOV,P2,#0FFH;
CLR,P0.0
LCALL DELAY1
SETB P0.0
CLR P0.1
LCALL DELAY1
SETB P0.1
CLR P0.2
LCALL DELAY1
SETB P0.2
CLR P0.3
LCALL DELAY1
SETB P0.3
CLR P0.4
LCALL DELAY1
SETB P0.4
CLR P0.5
LCALL DELAY1
SETB P0.5
CLR P0.6
LCALL DELAY1
SETB P0.6
CLR P0.7
LCALL DELAY1
SETB P0.7
CLR P2.0
LCALL DELAY1
SETB P2.0
MOV P0,#OFFH
CLR P0.0,P0.3,P0.6
LCALL DELAY2
SETB P0.0,P0.3,P0.6
CLR P0.1,P0.4,P0.7
LCALL DELAY2
SETB P0.1,P0.4,P0.7
CLR P0.2,P0.5,P2.0
LCALL DELAY2
SETB P0.2,P0.5,P2.0
AJMP MAIN
DELAY1:
time800ms: mov r5,#04h;
time800ms_1;:mov ; r6,#0f4h;
time800ms_2;:mov ; r7,#0ffh;
djnz ; r7,$
djnz ; r6,time800ms_2
djnz ; r5,time800ms_1
ret
DELAY2:
time1.6s;: mov ;r5,#04h;
time1;.6s_1;:mov ;r6,#0f4h;
time1;.6s_2;:mov ;r7,#0ffh;
djnz ;r7,$
djnz ;r6,time1.6s_2
djnz ;r5,time1.6s_1
ret
END 展开
展开全部
多了很多分号和逗号啊。给你改好了,这样的:
ORG 0000H
AJMP MAIN
ORG 0100H
MAIN
MOV P0,#0FFH
MOV P2,#0FFH
CLR P0.0
LCALL DELAY1
SETB P0.0
CLR P0.1
LCALL DELAY1
SETB P0.1
CLR P0.2
LCALL DELAY1
SETB P0.2
CLR P0.3
LCALL DELAY1
SETB P0.3
CLR P0.4
LCALL DELAY1
SETB P0.4
CLR P0.5
LCALL DELAY1
SETB P0.5
CLR P0.6
LCALL DELAY1
SETB P0.6
CLR P0.7
LCALL DELAY1
SETB P0.7
CLR P2.0
LCALL DELAY1
SETB P2.0
MOV P0,#OFFH
CLR P0.0
CLR P0.3
CLR P0.6
LCALL DELAY2
SETB P0.0
SETB P0.3
SETB P0.6
CLR P0.1
CLR P0.4
CLR P0.7
LCALL DELAY2
SETB P0.1
SETB P0.4
SETB P0.7
CLR P0.2
CLR P0.5
CLR P2.0
LCALL DELAY2
SETB P0.2
SETB P0.5
SETB P2.0
AJMP MAIN
DELAY1:
time800ms: mov r5,#04h
time800ms_1 :mov r6,#0f4h
time800ms_2 :mov r7,#0ffh
djnz r7,$
djnz r6,time800ms_2
djnz r5,time800ms_1
ret
DELAY2:
time1.6s : mov r5,#04h
time1 .6s_1 :mov r6,#0f4h
time1 .6s_2 :mov r7,#0ffh
djnz r7,$
djnz r6,time1.6s_2
djnz r5,time1.6s_1
ret
END
ORG 0000H
AJMP MAIN
ORG 0100H
MAIN
MOV P0,#0FFH
MOV P2,#0FFH
CLR P0.0
LCALL DELAY1
SETB P0.0
CLR P0.1
LCALL DELAY1
SETB P0.1
CLR P0.2
LCALL DELAY1
SETB P0.2
CLR P0.3
LCALL DELAY1
SETB P0.3
CLR P0.4
LCALL DELAY1
SETB P0.4
CLR P0.5
LCALL DELAY1
SETB P0.5
CLR P0.6
LCALL DELAY1
SETB P0.6
CLR P0.7
LCALL DELAY1
SETB P0.7
CLR P2.0
LCALL DELAY1
SETB P2.0
MOV P0,#OFFH
CLR P0.0
CLR P0.3
CLR P0.6
LCALL DELAY2
SETB P0.0
SETB P0.3
SETB P0.6
CLR P0.1
CLR P0.4
CLR P0.7
LCALL DELAY2
SETB P0.1
SETB P0.4
SETB P0.7
CLR P0.2
CLR P0.5
CLR P2.0
LCALL DELAY2
SETB P0.2
SETB P0.5
SETB P2.0
AJMP MAIN
DELAY1:
time800ms: mov r5,#04h
time800ms_1 :mov r6,#0f4h
time800ms_2 :mov r7,#0ffh
djnz r7,$
djnz r6,time800ms_2
djnz r5,time800ms_1
ret
DELAY2:
time1.6s : mov r5,#04h
time1 .6s_1 :mov r6,#0f4h
time1 .6s_2 :mov r7,#0ffh
djnz r7,$
djnz r6,time1.6s_2
djnz r5,time1.6s_1
ret
END
追问
在Keil uVision3运行还是错的啊 这是提示
WANGCHI.C(1): error C129: missing ';' before '0000'
wangchi.c - 1 Error(s), 0 Warning(s).
追答
MOV P0,#OFFH,这个指令把0写成o了,改成
MOV P0,#0FFH
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询