具有30种花样的流水灯汇编源程序!
本人从初中就对电子,无线电产生了浓厚的兴趣,至今已有10年的时间了。我对模拟电子技术和数字电子技术还算比较熟悉吧,实践上也不算赖。但对单片机我才是刚刚学,是一个单片机初学者。对单片机还比较陌生。学了一段时间的单片机,给我的感觉就是它太强大了!太好玩了!太有意思了!它可以用最简单的硬件电路,依靠程序来实现复杂的控制。流水灯就是一个很好的例子。下面我就给大家介绍一下我做的具有30种花样的流水灯,和大家一起分享。本花样流水灯,主要是由AT89S51单片机及8个不同颜色的发光二极管组成。共有30种花样。运用“MOV A,#data,RL,RR,INC,DEC”指令编出各种花样的数据码,并将这些数据码送入端口(P0口)显示。广泛的应用于商场,饭店,超市,KTV,广场等地方。
注:晶振12MHZ,本程序已通过实践验证!!!
汇编源程序
一下是全部代码 有些坛友下载附件会有问题ORG 0000H
MOV P0,#0FFH
START:MOV R0,#8
MOV A,#0FEH
LOOP1:MOV P0,A
ACALL DELAY
RL A
DJNZ R0,LOOP1
MOV R1,#8
MOV A,#7FH
LOOP2:MOV P0,A
ACALL DELAY
RR A
DJNZ R1,LOOP2
MOV R2,#4
LOOP3:MOV P0,#55H
ACALL DELAY
MOV P0,#0AAH
ACALL DELAY
DJNZ R2,LOOP3
MOV R3,#3
LOOP4:MOV P0,#7EH
ACALL DELAY
MOV P0,#0BDH
ACALL DELAY
MOV P0,#0DBH
ACALL DELAY
MOV P0,#0E7H
ACALL DELAY
MOV P0,#0DBH
ACALL DELAY
MOV P0,#0BDH
ACALL DELAY
MOV P0,#7EH
DJNZ R3,LOOP4
MOV R3,#3
LOOP5:MOV P0,#0E7H
ACALL DELAY
MOV P0,#0DBH
ACALL DELAY
MOV P0,#0BDH
ACALL DELAY
MOV P0,#7EH
ACALL DELAY
MOV P0,#0BDH
ACALL DELAY
MOV P0,#0DBH
ACALL DELAY
MOV P0,#0E7H
ACALL DELAY
DJNZ R3,LOOP5
MOV R4,#3
LOOP6:MOV P0,#00H
ACALL DELAY
MOV P0,#18H
ACALL DELAY
MOV P0,#3CH
ACALL DELAY
MOV P0,#7EH
ACALL DELAY
MOV P0,#0FFH
ACALL DELAY
DJNZ R4,LOOP6
MOV R4,#3
LOOP7:MOV P0,#00H
ACALL DELAY
MOV P0,#81H
ACALL DELAY
MOV P0,#0C3H
ACALL DELAY
MOV P0,#0E7H
ACALL DELAY
MOV P0,#0FFH
ACALL DELAY
DJNZ R4,LOOP7
MOV R4,#3
LOOP8:MOV P0,#0EFH
ACALL DELAY
MOV P0,#0CFH
ACALL DELAY
MOV P0,#8FH
ACALL DELAY
MOV P0,#0FH
ACALL DELAY
MOV P0,#0F7H
ACALL DELAY
MOV P0,#0F3H
ACALL DELAY
MOV P0,#0F1H
ACALL DELAY
MOV P0,#0F0H
ACALL DELAY
DJNZ R4,LOOP8
MOV R4,#4
MOV A,#0EFH
LOOP9:MOV P0,A
ACALL DELAY
RL A
DJNZ R4,LOOP9
MOV R4,#4
MOV A,#0F7H
LOOP10:MOV P0,A
ACALL DELAY
RR A
DJNZ R4,LOOP10
MOV R5,#9H
MOV A,#00H
MOV P0,A
LOOP11:INC A
MOV P0,A
RL A
ACALL DELAY
DJNZ R5,LOOP11
MOV R5,#9
MOV A,#00H
MOV P0,A
LOOP12:INC A
RR A
MOV P0,A
ACALL DELAY
DJNZ R5,LOOP12
MOV R5,#9
MOV A,#00H
MOV P0,A
LOOP13:DEC A
MOV P0,A
RL A
ACALL DELAY
DJNZ R5,LOOP13
MOV R5,#9
MOV A,#00H
MOV P0,A
LOOP14:DEC A
RR A
MOV P0,A
ACALL DELAY
DJNZ R5,LOOP14
MOV R5,#4
MOV A,#00H
LOOP15:MOV P0,A
ACALL DELAY
MOV P0,#0FFH
ACALL DELAY
DJNZ R5,LOOP15
MOV P0,#00H
MOV R0,#8
MOV A,#01H
LOOP16:MOV P0,A
ACALL DELAY
RL A
DJNZ R0,LOOP16
MOV R1,#8
MOV A,#80H
LOOP17:MOV P0,A
ACALL DELAY
RR A
DJNZ R1,LOOP17
MOV R2,#4
LOOP18:MOV P0,#0AAH
ACALL DELAY
MOV P0,#55H
ACALL DELAY
DJNZ R2,LOOP18
MOV R3,#3
LOOP19:MOV P0,#81H
ACALL DELAY
MOV P0,#42H
ACALL DELAY
MOV P0,#24H
ACALL DELAY
MOV P0,#18H
ACALL DELAY
MOV P0,#24H
ACALL DELAY
MOV P0,#42H
ACALL DELAY
MOV P0,#81H
DJNZ R3,LOOP19
MOV R3,#3
LOOP20:MOV P0,#18H
ACALL DELAY
MOV P0,#24H
ACALL DELAY
MOV P0,#42H
ACALL DELAY
MOV P0,#81H
ACALL DELAY
MOV P0,#42H
ACALL DELAY
MOV P0,#24H
ACALL DELAY
MOV P0,#18H
ACALL DELAY
DJNZ R3,LOOP20
MOV R4,#3
LOOP21:MOV P0,#0FFH
ACALL DELAY
MOV P0,#0E7H
ACALL DELAY
MOV P0,#0C3H
ACALL DELAY
MOV P0,#81H
ACALL DELAY
MOV P0,#00H
ACALL DELAY
DJNZ R4,LOOP21
MOV R4,#3
LOOP22:MOV P0,#0FFH
ACALL DELAY
MOV P0,#7EH
ACALL DELAY
MOV P0,#3CH
ACALL DELAY
MOV P0,#18H
ACALL DELAY
MOV P0,#00H
ACALL DELAY
DJNZ R4,LOOP22
MOV R4,#3
LOOP23:MOV P0,#10H
ACALL DELAY
MOV P0,#30H
ACALL DELAY
MOV P0,#70H
ACALL DELAY
MOV P0,#0F0H
ACALL DELAY
MOV P0,#08H
ACALL DELAY
MOV P0,#0CH
ACALL DELAY
MOV P0,#0EH
ACALL DELAY
MOV P0,#0FH
ACALL DELAY
DJNZ R4,LOOP23
MOV R4,#4
MOV A,#10H
LOOP24:MOV P0,A
ACALL DELAY
RL A
DJNZ R4,LOOP24
MOV R4,#4
MOV A,#08H
LOOP25:MOV P0,A
ACALL DELAY
RR A
DJNZ R4,LOOP25
MOV R5,#9H
MOV A,#00H
MOV P0,A
LOOP26:INC A
MOV P0,A
RL A
ACALL DELAY
DJNZ R5,LOOP26
MOV R5,#9
MOV A,#0FFH
MOV P0,A
LOOP27:INC A
RR A
MOV P0,A
ACALL DELAY
DJNZ R5,LOOP27
MOV R5,#9
MOV A,#0FFH
MOV P0,A
LOOP28:DEC A
MOV P0,A
RL A
ACALL DELAY
DJNZ R5,LOOP28
MOV R5,#9
MOV A,#0FFH
MOV P0,A
LOOP29:DEC A
RR A
MOV P0,A
ACALL DELAY
DJNZ R5,LOOP29
MOV R5,#4
MOV A,#0FFH
LOOP30:MOV P0,A
ACALL DELAY
MOV P0,#00H
ACALL DELAY
DJNZ R5,LOOP30
LJMP START
DELAY:MOV R7,#00H
L1:MOV R6,#00H
L2:DJNZ R6,L2
DJNZ R7,L1
RET
END
楼上真给力,给贴出来了,怎么你能下载? Ack 发表于 2012-4-1 21:18 static/image/common/back.gif
一下是全部代码 有些坛友下载附件会有问题
有电路图更好 有C语言版本吗 Ack 发表于 2012-4-1 21:18 static/image/common/back.gif
一下是全部代码 有些坛友下载附件会有问题
我更感兴趣的不是代码,而是功能,到底这30种花样是啥花样{:lol:} 以前见到过直接拿eprom的D0-D7口做流水灯的,用cd4040产生地址。不需要单片机,代码效率高 呵呵,够多花样的,30种,好久没看汇编代码了 收了看看 一句注释都不给呀~~~~~~~~~~ 内存那么大,还可以搞更多种的 yuguang 发表于 2012-4-24 23:01 static/image/common/back.gif
有电路图更好
{:funk:} 就这么几个端口所有灯接到P0口,还需要电路图?楼主不是已经贴照片了么,这还看不明白接了那些端口? yuguang 发表于 2012-4-24 23:01 static/image/common/back.gif
有电路图更好
{:sweat:} 额 是不是还要别人帮你把板子做出来 元件焊上 调试好 给你邮过去?
想知道楼主程序中有那三十种花样。 用PROTEUS仿真了一下楼主的程序。
仿真图片
工程和仿真文件: 把P0改成P1,用STC89C52运行了,效果还不错^ 顶楼主,下载了。 不错的效果,要是C的就更好了 下了 下了! 下载,学习学习
页:
[1]