89c52单片机流水灯汇编程序
3个回答
展开全部
ORG 0000H
LJMP MAIN
ORG 000BH
T0MS0 EQU NOT 50000 ; 50 mS 12.000 MHz
; 100 MS 6.000 MHz
T0ZD0: MOV TL0, #LOW T0MS0 ; TO 中断 计时 0
MOV TH0, #HIGH T0MS0
DJNZ R5, T0ZD8
MOV R5, #10 ; 100 mS #5
SETB 30H ; 500 mS 标志
T0ZD8: RETI
MAIN: MOV TL0, #LOW T0MS0 ; TO 100MS 中断 计时 0
MOV TH0, #HIGH T0MS0
MOV IE, #82H
SETB TR0
MOV R5, #10
MIN01: MOV R2, #16 ; 左循环2次
MOV A, #0FEH
MIN02: MOV P1, A
RL A
JNB 30H, $
CLR 30H
DJNZ R2, MIN02
JNB 30H, $
CLR 30H
MOV R2, #16 ; 右循环2次
MOV A, #7FH
MIN03: MOV P1, A
RR A
JNB 30H, $
CLR 30H
DJNZ R2, MIN03
JMP MIN01
END
LJMP MAIN
ORG 000BH
T0MS0 EQU NOT 50000 ; 50 mS 12.000 MHz
; 100 MS 6.000 MHz
T0ZD0: MOV TL0, #LOW T0MS0 ; TO 中断 计时 0
MOV TH0, #HIGH T0MS0
DJNZ R5, T0ZD8
MOV R5, #10 ; 100 mS #5
SETB 30H ; 500 mS 标志
T0ZD8: RETI
MAIN: MOV TL0, #LOW T0MS0 ; TO 100MS 中断 计时 0
MOV TH0, #HIGH T0MS0
MOV IE, #82H
SETB TR0
MOV R5, #10
MIN01: MOV R2, #16 ; 左循环2次
MOV A, #0FEH
MIN02: MOV P1, A
RL A
JNB 30H, $
CLR 30H
DJNZ R2, MIN02
JNB 30H, $
CLR 30H
MOV R2, #16 ; 右循环2次
MOV A, #7FH
MIN03: MOV P1, A
RR A
JNB 30H, $
CLR 30H
DJNZ R2, MIN03
JMP MIN01
END
展开全部
;
ORG 0000H
LJMP MAIN
MAIN: MOV A, #127
LOOP: MOV P1, A
CALL DL500MS
JNB F0, RIGHT
RL A
JB ACC.7, LOOP
CPL F0
SJMP LOOP
RIGHT: RR A
JB ACC.0, LOOP
CPL F0
SJMP LOOP
DL500MS:
MOV R6, #255 ;这里的数字,可自行修改
DJNZ R7, $
DJNZ R7, $
DJNZ R7, $
DJNZ R6, $ - 6
RET
END
ORG 0000H
LJMP MAIN
MAIN: MOV A, #127
LOOP: MOV P1, A
CALL DL500MS
JNB F0, RIGHT
RL A
JB ACC.7, LOOP
CPL F0
SJMP LOOP
RIGHT: RR A
JB ACC.0, LOOP
CPL F0
SJMP LOOP
DL500MS:
MOV R6, #255 ;这里的数字,可自行修改
DJNZ R7, $
DJNZ R7, $
DJNZ R7, $
DJNZ R6, $ - 6
RET
END
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询