基于51单片机心形流水灯C语言源程序Word格式文档下载.docx
《基于51单片机心形流水灯C语言源程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《基于51单片机心形流水灯C语言源程序Word格式文档下载.docx(11页珍藏版)》请在冰豆网上搜索。
![基于51单片机心形流水灯C语言源程序Word格式文档下载.docx](https://file1.bdocx.com/fileroot1/2022-10/28/51141913-13ab-4a39-8944-d6255b44d4c5/51141913-13ab-4a39-8944-d6255b44d4c51.gif)
j>
j--);
}
voidOn_all()//开启所有灯
{
P0=0x00;
P1=0x00;
P2=0x00;
P3=0x00;
voidOff_all()//关闭所有灯
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
}
voidls()//正向流水灯
P0=0x00;
delayms(400);
P0=0x01;
delayms(50);
P0=0x02;
P0=0x04;
P0=0x08;
P0=0x10;
P0=0x20;
P0=0x40;
P0=0x80;
P2=0x01;
P2=0x02;
P2=0x04;
P2=0x08;
P2=0x10;
P2=0x20;
P2=0x40;
P2=0x80;
P3=0x80;
P3=0x40;
P3=0x20;
P3=0x10;
P3=0x08;
P3=0x04;
P3=0x02;
P3=0x01;
P1=0x80;
P1=0x40;
P1=0x20;
P1=0x10;
P1=0x08;
P1=0x04;
P1=0x02;
P1=0x01;
Off_all();
P0=0xfe;
P0=0xfd;
P0=0xfb;
P0=0xf7;
P0=0xef;
P0=0xdf;
P0=0xbf;
P0=0x7f;
P0=0xff;
P2=0xfe;
P2=0xfd;
P2=0xfb;
P2=0xf7;
P2=0xef;
P2=0xdf;
P2=0xbf;
P2=0x7f;
P3=0x7f;
P3=0xbf;
P3=0xdf;
P3=0xef;
P3=0xf7;
P3=0xfb;
P3=0xfd;
P3=0xfe;
P1=0x7f;
P1=0xbf;
P1=0xdf;
P1=0xef;
P1=0xf7;
P1=0xfb;
P1=0xfd;
P1=0xfe;
P0=0xfc;
P0=0xf8;
P0=0xf0;
P0=0xe0;
P0=0xc0;
P2=0xfc;
P2=0xf8;
P2=0xf0;
P2=0xe0;
P2=0xc0;
P3=0x3f;
P3=0x1f;
P3=0x0f;
P3=0x07;
P3=0x03;
P1=0x3f;
P1=0x1f;
P1=0x0f;
P1=0x07;
P1=0x03;
voidfan_ls()//反向流水灯
{
delayms(300);
On_all();
delayms(400);
delayms(50);
P1=0x04;
P1=0x20;
P1=0x80;
P1=0x00;
P3=0x01;
P3=0x10;
P2=0x80;
P1=0xfc;
P1=0xf8;
P1=0xf0;
P1=0xe0;
P1=0xc0;
P3=0xfc;
delayms