本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这个交通灯的汇编语言有错误吗?
本人小白,求教
ORG 0000H
MOV P0,#00H
lJMP MAIN0
ORG 0030H
MAIN0: MOV 30H,#08H
MOV R6,#00H
MOV R7,#00H
MOV DPTR,#TABLE
MOV TMOD,#01H
MOV TL0,#0CDH
MOV TH0,#0BH
SETB TR0
SETB EA
SETB EX0
SETB EX1
CLR IT0
MAIN: MOV P0,#0F3H
MOV R6,#1EH
MOV R7,#19H
MAIN1: CALL DELAY
CJNE R7,#00H,MAIN1
MOV P0,#0F5H
MAIN2: CALL DELAY
MOV R7,#00H
CPL P0.1
CJNE R6,#00H,MAIN2
MOV P0,#0DEH
MOV R7,#1EH
MOV R6,#19H
MAIN3: CALL DELAY
CJNE R6,#00H,MAIN3
MOV P0,#0EEH
MAIN4: CALL DELAY
MOV R7,#00H
CPL P0.4
CJNE R6,#00H,MAIN4
JMP MAIN
DELAY: MOV A,R6
MOV B,#0AH
DIV AB
MOVC A,@A+DPTR
MOV P1,A
MOV R4,#4
LOOP1: MOV R3,#125
LOOP2: DJNZ R3,LOOP2
DJNZ R4,LOOP1
MOV A,B
MOVC A,@A+DPTR
MOV P2,A
MOV R4,#4
LOOP3:MOV R3,#125
LOOP4: DJNZ R3,LOOP4
DJNZ R4,LOOP3
MOV A,R7
MOV B,#0AH
DIV AB
MOVC A,@A+DPTR
MOV P1,A
MOV R4,#4
LOOP5: MOV R3,#125
LOOP6: DJNZ R3,LOOP6
DJNZ R4,LOOP5
MOV A,B
MOVC A,@A+DPTR
MOV P2,A
MOV R4,#4
LOOP7: MOV R3,#125
LOOP8: DJNZ R3,LOOP8
DJNZ R4,LOOP7
JBC TF0,LOOP
AJMP DELAY
LOOP: MOV TL0,#0CDH
MOV TH0,#0BH
MOV A,30H
DEC A
MOV 30H,A
JNZ DELAY
DEC R6
DEC R7
MOV 30H,#08H
RET
TABLE:DB 03FH,06H,05BH,04FH,66H
DB 6DH,7DH,07H,7FH,6FH,00H
END |