睡会制作跑马灯单片机程序啊
解决方案 »
- 循环打开网址,在打开一个后延时10秒后,打开下一个网址,怎么实现?
- 求这个问题的解决方法。判断题!
- 试用monthof(),yearof()函数遇到的问题?(Delphi初学,见笑了)
- 那位高人来帮帮我啊!delphi 出问题了!高分求救!!!
- web service用isapi如何在广域网上发布
- filter 问题???
- 兄弟们谁知道一般用来压缩wav文件的是什么,帮忙了~~~~~~~~~~~~~~`
- 高分求救!!请问怎么得到局域网里面的IP地址以及机器名??(不要用线程,而且要动态得到)
- 请教:在Delphi中,向表中添加数据时,空表是运行程序,能正确运行,向数据库表中添加数据。当程序退出,再次运行时,向表中加数据时就出错。为什么?
- Delphi中函数类型的virtual 和 dynamic 有些什么用?区别在哪里? 求教。
- RO中从表dataset自增字段与触发器的冲突
- 记录为什么不下移了?
1.
delphi演示程序基本如下放入一个timer控件,将时间间隔设为20,然后放入lable1: procedure TForm1.Timer1Timer(Sender: TObject);
begin
label1.Left:=label1.Left-10;
if label1.Left <=Form1.ClientRect.Left then
label1.Left:=form1.ClientRect.Right;
end;
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons, jpeg;type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
Timer2: TTimer;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Timer1Timer(Sender: TObject);
begin
if image1.Left<260 then
image1.Left:=image1.Left+5
else
begin
timer1.Enabled:=false;
timer2.Enabled:=true;
end;
end;procedure TForm1.Timer2Timer(Sender: TObject);
begin
if image1.Left>0 then
image1.Left:=image1.Left-5
else
begin
timer1.Enabled:=true;
timer2.Enabled:=false;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled:=true;
end;end.2.以mc51為環境,LED跑馬燈程序代碼:a.ORG 000H
AJMP START
START:
SETB C ;跑马灯,一直循环255次...
MOV R0,#0FFH
MOV A,#0
JX1:RLC A
MOV P1,A
LCALL DELAY500MS
DJNE R0,JX1SETB C
MOV R0,#8
MOV A,#0
JX:RLC A ;P1.0>>>P1.7依次亮1S
MOV P1,A
LCALL DELAY1S
DJNE R0,JX
;灯全亮,1S
MOV P1,#0FFH
LCALL DELAY1S
MOV P1,#0MOV P1,#01010101B ;偶数灯亮1S
LCALL DELAY1S
MOV P1,#0MOV P1,#10101010B ;奇数灯闪2次
LCALL DELAY500MS
MOV P1,#0
LCALL DELAY500MS
MOV P1,#10101010B
LCALL DELAY500MS
MOV P1,#0
AJMP :
MOV R7,#4
D1S1:MOV R6,#250
D1S:MOV R5,#250
DJNZ R5, R6,D1S
DJNZ R7,D1S1
RETDELAY1S:
MOV R7,#8
D1S1:MOV R6,#250
D1S:MOV R5,#250
DJNZ R5, R6,D1S
DJNZ R7,D1S1
RETb.#include
#define uchar unsigned char
#define uint unsigned int
sbit P10=P1^0;
sbit P11=P1^1;
sbit P12=P1^2;
sbit P13=P1^3;
sbit P14=P1^4;
sbit P15=P1^5;
sbit P16=P1^6;
sbit P17=P1^7;void main (void) //主程序
{
uint n;
while(1)
{
P1=0;P10=1; //从左到右亮
for(n=0;n<30000;n++);
P10=0;P11=1;
for(n=0;n<30000;n++);
P11=0;P12=1;
for(n=0;n<30000;n++);
P12=0;P13=1;
for(n=0;n<30000;n++);
P13=0;P14=1;
for(n=0;n<30000;n++);
P14=0;P15=1;
for(n=0;n<30000;n++);
P15=0;P16=1;
for(n=0;n<30000;n++);
P16=0;P17=1;
for(n=0;n<30000;n++);
P17=0;P16=1; //从右到左亮
for(n=0;n<30000;n++);
P16=0;P15=1;
for(n=0;n<30000;n++);
P15=0;P14=1;
for(n=0;n<30000;n++);
P14=0;P13=1;
for(n=0;n<30000;n++);
P13=0;P12=1;
for(n=0;n<30000;n++);
P12=0;P11=1;
for(n=0;n<30000;n++);
P11=0;P10=1;
for(n=0;n<30000;n++);
P10=0;P15=0;
for(n=0;n<30000;n++); P1=0x00; //从两边到中间亮
for(n=0;n<30000;n++);
P10=1;P17=1; //1,6亮,其它灭
for(n=0;n<30000;n++);
P11=1;P16=1;
P10=0;P17=0;
for(n=0;n<30000;n++);
P12=1;P15=1;
P11=0;P16=0;
for(n=0;n<30000;n++);
P13=1;P14=1;
P12=0;P15=0;
for(n=0;n<30000;n++);
P1=0x00; //从中间到两边
for(n=0;n<30000;n++);
P13=1;P14=1; //2,3亮,其它灭
for(n=0;n<30000;n++);
P12=1;P15=1;
P13=0;P14=0;
for(n=0;n<30000;n++);
P11=1;P16=1;
P12=0;P15=0;
for(n=0;n<30000;n++);
P10=1;P17=1;
P11=0;P16=0;
for(n=0;n<30000;n++);
}
}
居然是网上的代码
我以为你自己用delphi操作单片机写跑马灯
如果真的写出来 那我真的服了
如果你要控制跑马灯
最好是用c 或者是C++
根据不同的硬件来写程序如果你想用delphi来直接控制的话
是不现实的 至少我没找到用delphi直接控制的因为控制跑马灯一般是 用c写完程序后 烧到单片机上
delphi好像没看到过~