资源描述:
《51单片机爱心流水灯原理与制作》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、.WORD文档下载可编辑.电路原理图:技术资料整理分享.WORD文档下载可编辑.原件清单:1、51单片机x1、40Pin座x12、LEDx32(建议用5mm七彩的)3、电阻470Ωx334、晶振12MHzx15、10uf电解电容x1、谐振瓷片电容30pfx26·其他的可以看自己的爱好去加7、其实也可以不用那么多的电阻,用几个排阻就OK了。效果展示:技术资料整理分享.WORD文档下载可编辑.技术资料整理分享.WORD文档下载可编辑.作品程序:#include#defineucharunsignedcharucharflag=200;///////
2、////////////////////////////////////////////////////////////////ucharcodeTab1[]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0xFF};//暗中左移向下ucharcodeTab2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF};//暗中右移向上ucharcodeTab3[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x00};//亮中左移向下ucharco
3、deTab4[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00};//亮中右移向上ucharcodeTab11[]={0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0xff};//暗中左移向下ucharcodeTab22[]={0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00,0xff};////////////////////////////////////////////////////////////////////ucharcodeTab33[]
4、={0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF};ucharcodeTab44[]={0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF};ucharcodeTab55[]={0x08,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xff};ucharcodeTab5[]={0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xff};ucharcodeTab6[]={0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7
5、F,0xff};ucharcodeTab7[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};技术资料整理分享.WORD文档下载可编辑.ucharcodeTab8[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};////////////////////////////////////////////////////////////////voidshansuo();voidxl();////////////////////////////////////////////////////
6、///////////voiddelay(void){unsignedcharm,n;for(m=0;m7、Tab44[i];P3=Tab55[i];delay();}}///////////////////////////////////////////voidhy2(void)//暗中逆时针转360。(一个一个点亮){unsignedchari;for(flag=250;flag>0;flag=flag-50){P0=0xff;P1=0xff;P2=0xff;P3=0xff;for(i=0;i<8;i++){P0=Tab11[i];delay();}for(i=0;i<8;i++){P2=Tab11[i];技术资料整理分享.WORD文档下载可编辑.delay();
8、}for(i=0;i<8