您的当前位置:首页循迹小车程序

循迹小车程序

2024-07-06 来源:乌哈旅游


ORG 0000H START: JB P0.4,START MOV P0,#0FAH MOV R0,#04H LOOP: CLR P0.7 CLR P2.0 ACALL DELAY CPL P0.7 CPL P2.0 DJNZ R0,LOOP

SETB P0.0 CLR P0.1 SETB P0.2 CLR P0.3

LOOP1: MOV A,P3 ANL A,#60H CJNE A,#00H,LOOP2 SETB P0.0 SETB P0.1 SETB P0.2 SETB P0.3 JMP LOOP1

LOOP2: CJNE A ,#60H ,A1 SETB P0.0 SETB P0.1 SETB P0.2 SETB P0.3 JMP LOOP1 A1: JNB P3.5,B1 JNB P3.6,B2 RET

B1: SETB P0.0 CLR P0.1 SETB P0.2 SETB P0.3 ACALL DELAY JMP LOOP1 B2: SETB P0.2 CLR P0.3 SETB P0.0 SETB P0.1 ACALL DELAY JMP LOOP1 JNB P0.4,C1

JMP LOOP1 C1: SETB P0.0 SETB P0.1 SETB P0.2 SETB P0.3 JMP START DELAY: MOV R5,#25

DLY1: MOV R6,#100 DLY2: MOV R7,#100 DJNZ R7,$

DJNZ R6,DLY2 DJNZ R5,DLY1

RET END

因篇幅问题不能全部显示,请点此查看更多更全内容