1、编写双向跑马灯,要求双向跑到头。每隔0.6秒跑一个灯(可以用定时器编写)。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP ZOUMA
ORG 0100H
MAIN: MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0B0H
MOV R0,#0
MOV R1,#12
MOV R2,#8
MOV A,#80H
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV P3,#00H
SETB ET0
SETB EA
SETB TR0
SJMP $
ZOUMA: MOV TH0,#3CH
MOV TL0,#0B0H
DJNZ R1,FH1
MOV R1,#12
CJNE R0,#0,Z1
MOV P0,A
RR A
DJNZ R2,FH1
INC R0
MOV R2,#8
MOV A,#80H
LJMP FH1
Z1: CJNE R0,#1,Z2
MOV P0,#00H
MOV P1,A
RR A
DJNZ R2,FH1
INC R0
MOV R2,#8
MOV A,#80H
LJMP FH1
Z2: CJNE R0,#2,Z3
MOV P1,#00H
MOV P2,A
RR A
DJNZ R2,FH1
INC R0
MOV R2,#8
MOV A,#80H
LJMP FH1
Z3: CJNE R0,#3,Z4
MOV P2,#00H
MOV P3,A
RR A
DJNZ R2,FH1
INC R0
MOV R2,#7
MOV A,#02H
NOP
FH1: LJMP FH
Z4: CJNE R0,#4,Z5
MOV P3,#00H
MOV P3,A
RL A
DJNZ R2,FH
INC R0
MOV R2,#8
MOV A,#01H
LJMP FH
Z5: CJNE R0,#5,Z6
MOV P3,#00H
MOV P2,A
RL A
DJNZ R2,FH
INC R0
MOV R2,#8
MOV A,#01H
LJMP FH
Z6: CJNE R0,#6,Z7
MOV P2,#00H
MOV P1,A
RL A
DJNZ R2,FH
INC R0
MOV R2,#8
MOV A,#01H
LJMP FH
Z7: CJNE R0,#7,FH
MOV P1,#00H
MOV P0,A
RL A
DJNZ R2,FH
INC R0
MOV R2,#8
MOV R0,#0
LJMP
FH
FH: RETI
RET
END