单片机流水灯c语言源代码

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
for(i1=0;i1<6;i1++)
{
a=_cror_(a,1);
P0=a;
delay(z);
}
P0=0xfe;
delay(z);
P0=0xff;
delay(z);
}
void lsd3()//lsd3两个灯流水双程模式2
{
uchar a,i,j,k,l,l1,k1,j1,i1;
a=0xfe;
P0=a;
P3=a;
delay(z);
}
P3=0xff;
a=0xfe;
P1=a;
delay(z);
for(l=0;l<7;l++)
{
a=_crol_(a,1);
P1=a;
delay(z);
}
a=0xbf;
P1=a;
delay(z);
for(l1=0;l1<6;l1++)//l1==6仅单个灯亮从下往上流
{
a=_cror_(a,1);
P2=a;
delay(z);
}
P2=0xff;
a=0x7f;
P0=a;
delay(z);
for(i1=0;i1<7;i1++)
{
a=_cror_(a,1);
P0=a;
delay(z);
}
P0=0xff;
}
void lsd2()//lsd2两个灯流水双程模式1
{
uchar a,i,j,k,l,l1,k1,j1,i1;
0xe7,0xdb,0xbd,0x7e,
0xbd,0xdb,0xe7,0xff};
uchar code table5[]={
0xe7,0xc3,0x81,0x00,
0x81,0xc3,0xe7,0xff};
uchar code table6[]={
0x7e,0x3c,0x18,0x00,
0x18,0x3c,0x7e,0xff};
0xf8,0xfc,0xfe,0xff};
uchar code table2[]={
0x7f,0x3f,0x1f,0x0f,
0x07,0x03,0x01,0x00};
uchar code table3[]={
0x01,0x03,0x07,0x0f,
0x1f,0x3f,0x7f,0xff};
uchar code table4[]={
void delay(uchar);
void lsd1();
void lsd2();
void lsd3();
void lsd4();
void lsd5();
void lsd6();
void lsd7();
void lsd8();
void lsd9();
void lsd10();
void lsd11();
a=0xfe;
P0=a;
delay(z);
a=a<<1;
P0=a;
delay(z);
for(i=0;i<6;i++)
{
a=_crol_(a,1);
P0=a;
delay(z);
}
P0=0x7f;
P2=0xfe;
delay(z);
P0=0xff;
a=0xfc;
P2=a;
delay(z);
for(j=0;j<6;j++)
delay(z);
for(i=x;i>0;i--)
for(j=250;j>0;j--);
}
void lsd1()//lsd1单个流水灯双程模式1
{
uchar a,i,j,k,l,l1,k1,j1,i1;
a=0xfe;
P0=a;
delay(z);
for(i=0;i<7;i++)//仅单个灯亮从上往下流
{
a=_crol_(a,1);
P1=a;
delay(z);
}
P1=0xff;
a=0x7f;
P3=a;
delay(z);
for(k1=0;k1<7;k1++)
{
a=_cror_(a,1);
P3=a;
delay(z);
}
P3=0xff;
a=0x7f;
P2=a;
delay(z);
for(j1=0;j1<7;j1++)
{
a=_cror_(a,1);
}
P3=0xfe;
P2=0x7f;
delay(z);
P3=0xff;
a=0x3f;
P2=a;
delay(z);
for(j1=0;j1<6;j1++)
{
a=_cror_(a,1);
P2=a;
delay(z);
}
P2=0xfe;
P0=0x7f;
delay(z);
P2=0xff;
a=0x3f;
P0=a;
delay(z);
{
a=_crol_(a,1);
P2=a;
delay(z);
}
P2=0x7f;
P3=0xfe;
delay(z);
P2=0xff;
a=0xfc;
P3=a;
delay(z);
for(k=0;k<6;k++)
{
a=_crol_(a,1);
P3=a;
delay(z);
}
P3=0x7f;
P1=0xfe;
delay(z);
for(l1=0;l1<6;l1++)
{
a=_cror_(a,1);
P1=a;
delay(z);
}
P1=0xfe;
P3=0x7f;
delay(z);
P1=0xff;
a=0x3f;
P3=a;
delay(z);
for(k1=0;k1<6;k1++)
{
a=_cror_(a,1);
PFra Baidu bibliotek=a;
delay(z);
P0=a;
delay(z);
}
P0=0xff;
a=0xfe;
P2=a;
delay(z);
for(j=0;j<7;j++)
{
a=_crol_(a,1);
P2=a;
delay(z);
}
P2=0xff;
a=0xfe;
P3=a;
delay(z);
for(k=0;k<7;k++)
{
a=_crol_(a,1);
#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar z=50,e=0x00,f=0xff;
uchar code table1[]={
0x80,0xc0,0xe0,0xf0,
void lsd12();
main()
{
while(1)
{
lsd1();
lsd2();
lsd3();
lsd4();
lsd5();
lsd6();
lsd7();
lsd8();
lsd9();
lsd10();
lsd11();
lsd12();
}
}
void delay(uchar x)//延时函数
{
uint i,j;
P3=0xff;
a=0xfc;
P1=a;
delay(z);
for(l=0;l<6;l++)
{
a=_crol_(a,1);
P1=a;
delay(z);
}
P1=0x7f;
delay(z);
P1=0xff;
delay(z);
a=0x7f;
P1=a;
delay(z);
a=a>>1;
P1=a;
delay(z);
相关文档
最新文档