单片机流水灯c语言源代码.doc
《单片机流水灯c语言源代码.doc》由会员分享,可在线阅读,更多相关《单片机流水灯c语言源代码.doc(15页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、#include#include#define uint unsigned int #define uchar unsigned charuchar z=50,e=0x00,f=0xff;uchar code table1= 0x80,0xc0,0xe0,0xf0,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=0xe7,0xdb,0xb
2、d,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;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(
3、);void lsd12();main()while(1) lsd1(); lsd2();lsd3(); lsd4();lsd5(); lsd6(); lsd7();lsd8();lsd9();lsd10(); lsd11(); lsd12(); void delay(uchar x) /延时函数uint i,j;for(i=x;i0;i-)for(j=250;j0;j-); void lsd1() /lsd1 单个流水灯双程模式1uchar a,i,j,k,l,l1,k1,j1,i1;a=0xfe;P0=a;delay(z);for(i=0;i7;i+) /仅单个灯亮从上往下流a=_crol
4、_(a,1);P0=a;delay(z);P0=0xff;a=0xfe;P2=a;delay(z);for(j=0;j7;j+)a=_crol_(a,1);P2=a;delay(z);P2=0xff;a=0xfe;P3=a;delay(z);for(k=0;k7;k+)a=_crol_(a,1);P3=a;delay(z);P3=0xff;a=0xfe;P1=a;delay(z);for(l=0;l7;l+)a=_crol_(a,1);P1=a;delay(z);a=0xbf;P1=a;delay(z);for(l1=0;l16;l1+)/l1=6 仅单个灯亮从下往上流a=_cror_(a,1
5、);P1=a;delay(z);P1=0xff;a=0x7f;P3=a;delay(z);for(k1=0;k17;k1+)a=_cror_(a,1);P3=a;delay(z);P3=0xff;a=0x7f;P2=a;delay(z);for(j1=0;j17;j1+)a=_cror_(a,1);P2=a;delay(z);P2=0xff;a=0x7f;P0=a;delay(z);for(i1=0;i17;i1+)a=_cror_(a,1);P0=a;delay(z);P0=0xff;void lsd2() /lsd2 两个灯流水双程模式1uchar a,i,j,k,l,l1,k1,j1,i
6、1;a=0xfe;P0=a;delay(z);a=a1;P0=a;delay(z);for(i=0;i6;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;j6;j+)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;k6;k+)a=_crol_(a,1);P3=a;delay(z);P3=0x7f;P1=0xfe;delay(z
7、);P3=0xff;a=0xfc;P1=a;delay(z);for(l=0;l1;P1=a;delay(z);for(l1=0;l16;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;k16;k1+)a=_cror_(a,1);P3=a;delay(z);P3=0xfe;P2=0x7f;delay(z);P3=0xff;a=0x3f;P2=a;delay(z);for(j1=0;j16;j1+)a=_cror_(a,1);P2=a;delay(z);P
8、2=0xfe;P0=0x7f;delay(z);P2=0xff;a=0x3f;P0=a;delay(z);for(i1=0;i16;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;delay(z);a=a1;P0=a;delay(z);for(i=0;i1;P2=a;delay(z);for(j=0;j6;j+)a=_cror_(a,1);P2=a;delay(z);P2=0
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 单片机 流水 语言 源代码
限制150内