用汇编编的流水灯程序求改错。。。。。。。。。。
时间:10-02
整理:3721RD
点击:
ORG 0000H
MOV SP,#2FH
MOV A,#0EFH
MOV P1,A
LCALL DELAY
LOOP: MOV R4,#7
LOOP1: RL A
MOV P1,A
LCALL DELAY
DJNZ R4,LOOP1
MOV R4,#7
LOOP2: RR A
MOV P1,A
LCALL DELAY
DJNZ R4,LOOP2
LJMP LOOP
DELAY: MOV R1,#255
MOV R3,#255
SCAN: MOV R2,#200
DJNZ R1,SCAN
DJNZ R3,SCAN
RET
END
MOV SP,#2FH
MOV A,#0EFH
MOV P1,A
LCALL DELAY
LOOP: MOV R4,#7
LOOP1: RL A
MOV P1,A
LCALL DELAY
DJNZ R4,LOOP1
MOV R4,#7
LOOP2: RR A
MOV P1,A
LCALL DELAY
DJNZ R4,LOOP2
LJMP LOOP
DELAY: MOV R1,#255
MOV R3,#255
SCAN: MOV R2,#200
DJNZ R1,SCAN
DJNZ R3,SCAN
RET
END
问题呢?
延时太短了吧,延时程序改成
DELAY: MOV R1,#50
D1: MOV R3,#255
SCAN: MOV R2,#200
DJNZ R2,$
DJNZ R3,SCAN
DJNZ R1,D1
RET
具体延时时间没法确定,不知道你用的多少的晶振