基于51单片机的LED旋转显示器制作

发布者:真瓷堂最新更新时间:2021-01-17 来源: eefocus关键字:51单片机  LED  旋转显示器 手机看文章 扫描二维码
随时随地手机看文章

由于刚学51单片机,加上制作电路板软件也是从零开始,的确花了我不少的时间和精力。不过也就是在这艰难的独立制作中,真正学到了不少实在的东西。原理就不多说了。


下面分享一下我的制作过程。这里有关于本制作的更详细的图片展示:


首先是制作效果图:

电路图

电路采用的是无限供电模块给单片机供电的。采用无限供电。无摩擦,震动小。LED与单片机引脚之间的连接采用的是细小的漆包线。省去了限流电阻。省去复位电路制作起来更简单方便。


准备主要材料:因很多人不知材料哪里买,先将地址链接在材料名称,点击就进去了


1.51单片机1片


2.单片机插槽和万能电路板(洞洞板)


3.贴片LED0603(颜色自定,如果焊接技术不够可以用大点的,如1206,多买一些,备用)


4.红外接收、发送


5.电阻R4-R6


6.细小漆包线


7.排针(下载接口用)


8.24兆晶振


9.电容


以上材料可以在同一个店买,省了不少邮费,可以联系卖家的QQ411567269,加qq注明“led电子元件”,


10.12v电源(充电用)


11.电动马达


以上两个同一家店可以买到


12.7.4v锂电池(也可用两颗废旧手机电池)


13.无线供电模块


14.stc下载程序器


下面开始动手了。


1无线供电模块

喜之郎果冻外壳

程序:


/*********旋转显示***************/


#include


#define uint unsigned int


#define uchar unsigned char


sbit D1=P3^2;


sbit D2=P3^4;


sbit D3=P1^0;


sbit D4=P0^7;


void delay();


void xing();


void zhunbei();


uchar code hanzi1[];


uchar code hanzi2[];


uchar code hanzi3[];


uchar code hanzi4[];


uchar code hanzi5[];


uchar code hanzi6[];


uchar code hanzi7[];


uchar code hanzi8[];


uchar code hanzi9[];


uchar code hanzi10[];


uchar code hanzi11[];


uchar code hanzi12[];


uchar code hanzi13[];


uchar code hanzi14[];


uchar code hanzi15[2][64];


uchar code hanzi16[2][64];


uchar code hanzi17[];


uchar code hanzi18[];


uchar code hanzi19[];


uchar code hanzi20[];


uchar code hanzi21[];


uchar code hanzi22[];


uchar cc,bb,mm,dd,tt,kk,kk1,kk2;kk4;


uint kk3,jj,aa;


void main()


{


zhunbei();


while(1)


{


if(D1==0)


{


if(kk==11)


{


if(cc>112)


{


if(kk4<7)


{


kk4++;


kk2++;


}


if(kk4==7)


{


kk4=6;


kk2=14;


}


}


}


for(aa=kk4;aa

{


P0=hanzi19[aa];


P1=hanzi20[aa];


D3=D4=0;


delay();


}


/////////////////////////////////////////////////////////////


xing();


/////////////////////////////////////////////////////////


if(kk==1)


{


mm=cc=0;


bb=bb+1;


if(bb==95)


{


bb=94;


dd++;


if(dd==97)


dd=96;


}


for(aa=dd;aa<=bb;aa++) //////////////无论何时何地


{


P0=hanzi3[aa];


P1=hanzi4[aa];


delay();


P0=0xff;


P1=0xff;


}


}


/////////////////////////////////////////////////////


if(kk==2)


{


dd=bb=0;


cc++;


if(cc==95)


{


cc=94;


mm++;


if(mm==97)


mm=96;


}


for(aa=mm;aa<=cc;aa++) //////////////无论身在何方


{


P0=hanzi5[aa];


P1=hanzi6[aa];


delay();


P0=0xff;


P1=0xff;


}


}


/////////////////////////////////////////////////


if(kk==3)


{


mm=cc=0;


bb++;


if(bb==127)


{


bb=126;


dd++;


if(dd==129)


dd=128;


}


for(aa=dd;aa<=bb;aa++) /////我愿把无数的思念


{


P0=hanzi7[aa];


P1=hanzi8[aa];


delay();


P0=0xff;


P1=0xff;


}


}


//////////////////////////////////////////////


if(kk==4)


{


dd=bb=0;


cc++;


if(cc==111)


{


cc=110;


mm++;


if(mm==113)


mm=112;


}


for(aa=mm;aa<=cc;aa++)


{


P0=hanzi9[aa]; ///////////////////////化作无限的祝福


P1=hanzi10[aa];


delay();


P0=0xff;


P1=0xff;


}


}


///////////////////////////////////////


if(kk==5)


{


mm=cc=0;


bb++;


if(bb==111)


{


bb=110;


dd++;


if(dd==113)


dd=112;


}


for(aa=dd;aa<=bb;aa++) ////////祝你健康快乐!


{


P0=hanzi11[aa];


P1=hanzi12[aa];


delay();


P0=0xff;


P1=0xff;


}


}


/////////////////////////////////////////////


if(kk==6)


{


dd=bb=0;


cc++;


if(cc==40)


{


cc=39;


}


for(aa=0;aa<=cc;aa++)


{


P0=hanzi13[aa]; ///////////////////////(*^__^*) 嘻嘻……


P1=hanzi14[aa];


delay();


P0=0xff;


P1=0xff;


}


}


////////////////////////////////////////////


if(kk==7)


{


cc=0;


bb++;


if(bb==59)


{


bb=58;


dd++;


if(dd==7)


{


dd=0;


mm++;


if(mm==2)


mm=0;


}


}


for(aa=0;aa<=bb;aa++) ////////↖(^ω^)↗


{


P0=hanzi15[mm][aa];


P1=hanzi16[mm][aa];


delay();


P0=0xff;


P1=0xff;


}


}


/////////////////////////////////////


if((kk==8)||(kk==9)||(kk==10))


{


dd=bb=0;


kk3++;


if(kk3==383)


{


kk3=382;


}


if(kk3>176)


jj++;


for(aa=jj;aa<=kk3;aa++)


{


P0=hanzi21[aa]; ///////////////////////每当...........


P1=hanzi22[aa];


delay();


P0=0xff;


P1=0xff;


}


}


//////////////////////


xing();


//////////////////////////////////


if(kk==11)


{


kk3=kk1=0;


mm=0;


cc++;


if(cc==120)


{


cc=119;


}


for(aa=cc;aa<=128;aa++)


{


P0=hanzi17[aa]; ///////////////////////箭头


P1=hanzi18[aa];


delay();


P0=0xff;


P1=0xff;


}


}


//////////////////////////////////////


D3=D4=0;


//////////////////////////////////////////////////


}


}


}


void zhunbei()


{


TMOD=0x11;//设置定时器0为工作方式1


TH0=0;


TL0=0;


EA=1;//开总中断


ET0=1;//开定时器0中断


TR0=1;//启动定时器0


kk2=8;


kk1=0;


dd=0;


bb=0;


kk=1;


}


void xing()


{


for(aa=16;aa>0;aa--)


{


P0=hanzi1[aa];


P1=hanzi2[aa]; ////心型


delay();


P0=0xff;


P1=0xff;


}


}


void delay()//延时


{


uint x;


for(x=15;x>1;x--);


}


void time0() interrupt 1


{


TH0=0;


TL0=0;


tt++;


if(tt==255)


{


tt=0;


kk++;


if(kk==12)


{


kk=1;


kk2=8;


cc=0;


mm=0;


kk1=0;


dd=0;


bb=0;


kk4=0;


cc=0;


jj=0;


}


}


}


uchar code hanzi1[]={0xFF,0xF1,0xE0,0xE0,0xE0,0xF0,0xF0,0xF8,0xFC,0xF8,0xF0,0xF0,0xE0,0xE0,0xE0,0xF1};


uchar code hanzi2[]={0xFF,0xFF,0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF};


//////////////////////////////////////////////


uchar code hanzi3[]={0xFF,0xFD,0xBD,0xBD,0xBD,0xBC,0x81,0xBD,0xBC,0xBD,0xBD,0xBD,0xFD,0xFD,0xFF,0xFF,


0xFD,0xFD,0xBD,0xCC,0xFF,0xFD,0xFB,0xF6,0xCF,0x3F,0xCF,0xF6,0xFB,0xFD,0xFD,0xFF,


0xFF,0xFE,0xF9,0xE0,0x1F,0xDF,0xD8,0xDB,0xDB,0xD8,0xDF,0xDF,0xC0,0xDF,0xDF,0xFF,


0xFF,0xC0,0xDE,0xDE,0xDE,0xC0,0xFF,0xF7,0xF7,0xF7,0xF7,0xF7,0x00,0xF7,0xF7,0xFF,


0xFF,0xFE,0xF9,0xE0,0x1F,0xDF,0xD8,0xDB,0xDB,0xD8,0xDF,0xDF,0xC0,0xDF,0xDF,0xFF,


0xFB,0xFB,0xFB,0x00,0xFB,0xFB,0xFE,0xE0,0xFE,0xFD,0x00,0xFB,0xF7,0xF0,0xFF,0xFF};


uchar code hanzi4[]={0xFE,0xFD,0xFB,0xF7,0xCF,0x3F,0xFF,0xFF,0x03,0xFD,0xFD,0xFD,0xFD,0xF1,0xFF,0xFF,


0xFF,0xFF,0xFF,0x01,0xFB,0xF7,0xFF,0x03,0xDD,0xBD,0x7D,0xFD,0xFD,0xF1,0xFF,0xFF,


0x7F,0xFF,0xFF,0x00,0xFF,0xFF,0x0F,0xDF,0xDF,0x0F,0xFD,0xFE,0x01,0xFF,0xFF,0xFF,


0xFF,0x03,0xF7,0xF7,0xF7,0x03,0xFF,0xFF,0x7F,0x9F,0xFD,0xFE,0x01,0xF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F,0x00,0xFF,0xFF,0x0F,0xDF,0xDF,0x0F,0xFD,0xFE,0x01,0xFF,0xFF,0xFF,


0xFF,0xFE,0xFD,0xFB,0xE7,0x1F,0xFF,0xFF,0xFD,0xFE,0xFD,0x03,0xFF,0xFF,0xFF,0xFF};


//////////////////////////////////////////////////////


uchar code hanzi7[]={0xFB,0xDB,0xDB,0xDB,0x80,0x3B,0xBB,0xFB,0xFB,0x00,0xFB,0xBB,0xCB,0xFA,0xFB,0xFF,


0xFF,0xFF,0x80,0xBF,0xBF,0xA0,0xAA,0xAA,0x8A,0xAA,0xAA,0xAA,0xA0,0xBF,0xBF,0xFF,


0xF7,0xF7,0xF7,0x00,0xF7,0xF6,0xFF,0x80,0xBE,0xBE,0x80,0xBE,0xBE,0x80,0xFF,0xFF,


0xFF,0xFD,0xBD,0xBD,0xBD,0xBC,0x81,0xBD,0xBC,0xBD,0xBD,0xBD,0xFD,0xFD,0xFF,0xFF,


0xF6,0xB5,0xD3,0xF7,0x00,0xF7,0xD3,0xB5,0xFE,0xF1,0x0E,0xEF,0xEF,0xE0,0xEF,0xFF,


0xFF,0xE0,0xCF,0x2F,0xEF,0xEF,0xE0,0xFD,0xF3,0x0E,0xEF,0xEF,0xEF,0xE0,0xFF,0xFF,


0xFF,0xFF,0x80,0xB6,0xB6,0xB6,0xB6,0x80,0xB6,0xB6,0xB6,0xB6,0x80,0xFF,0xFF,0xFF,


0xFD,0xFD,0xFB,0xFB,0xF6,0xEE,0xD6,0x38,0xDE,0xEE,0xF6,0xFB,0xFB,0xFD,0xFD,0xFF};


uchar code hanzi8[]={0xFF,0xEF,0xED,0xDE,0x01,0xBF,0x7D,0xFD,0xFB,0x37,0xCF,0xD7,0xBB,0x7D,0xE0,0xFF,


0xFE,0xF9,0x07,0xFE,0xD9,0xBF,0x79,0xDE,0xEE,0x12,0xFE,0x7C,0xBF,0xD7,0xF9,0xFF,


0xDF,0xDD,0xBE,0x01,0x7F,0xFF,0xFF,0x03,0xFD,0xFD,0xFD,0xFD,0xFD,0x7D,0xF1,0xFF,


0xFE,0xFD,0xFB,0xF7,0xCF,0x3F,0xFF,0xFF,0x03,0xFD,0xFD,0xFD,0xFD,0xF1,0xFF,0xFF,


0xBE,0xA6,0x95,0x39,0xBB,0xB5,0x8E,0xFF,0xFE,0xFD,0x33,0xCF,0x33,0xFD,0xFE,0xFF,


0xFF,0x01,0x7B,0x7B,0x7B,0x7B,0x01,0xFF,0xFF,0xFF,0x3D,0xFE,0xFD,0x03,0xFF,0xFF,


0xFD,0xE3,0x7F,0xFF,0xC3,0xFD,0xFD,0xBD,0xCD,0xFD,0xFD,0xF1,0x5F,0xEF,0xF3,0xFF,


0xFD,0xF3,0xFF,0xFF,0xE3,0xFD,0xFD,0xDD,0xA5,0x7D,0xFD,0xF1,0xFF,0xEF,0xF3,0xFF};


/////////////////////////////////////////////////////////


uchar code hanzi9[]={0xFF,0xFE,0xF9,0xE0,0x1F,0xFF,0xFF,0xFF,0x00,0xFD,0xFB,0xF7,0xEF,0xDF,0xFF,0xFF,


0xFF,0xFE,0xF9,0xE0,0x1F,0xFD,0xF3,0x0F,0xE0,0xEE,0xEE,0xEE,0xEE,0xEF,0xEF,0xFF,


0xFF,0xFD,0xBD,0xBD,0xBD,0xBC,0x81,0xBD,0xBC,0xBD,0xBD,0xBD,0xFD,0xFD,0xFF,0xFF,


0xFF,0x80,0xBB,0xA5,0x9E,0xFF,0x80,0xB6,0xB6,0xB6,0xB6,0xB6,0x80,0xFF,0xFF,0xFF,


0xFF,0xE0,0xCF,0x2F,0xEF,0xEF,0xE0,0xFD,0xF3,0x0E,0xEF,0xEF,0xEF,0xE0,0xFF,0xFF,


0xEF,0xEF,0x6E,0x88,0xE6,0xFF,0x81,0xBD,0xBC,0xBD,0xBD,0xBC,0xBD,0x81,0xFF,0xFF,


0xEF,0x6F,0x8C,0xE2,0xEF,0xFF,0xBF,0xA1,0xAD,0xAD,0xAD,0xAD,0xAD,0xA1,0xBF,0xFF,


};


uchar code hanz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xBE,0x3E,0xBE,0xFE,0xFE,0xFF,0xFF,


0xFF,0xFF,0xF1,0xE0,0xE0,0xF1,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};


uchar code hanzi12[]={0xBF,0x7F,0xFF,0x00,0xFE,0x3D,0xFB,0xE7,0x1F,0xFF,0xFF,0x03,0xFD,0xFD,0xE1,0xFF,


0x7F,0xFF,0xFF,0x00,0xFF,0xF7,0xCF,0x3F,0xFD,0xFE,0x01,0xFF,0x7F,0x9F,0xE7,0xFF,


0xFF,0xFF,0x00,0xFE,0x6D,0x73,0x0B,0xED,0x6D,0x6D,0x01,0x6D,0x6D,0x6D,0xED,0xFF,


0xFD,0xF3,0x0F,0xFD,0x3B,0x57,0x6D,0x7E,0x01,0x5F,0x6F,0x77,0x6B,0xDD,0xFD,0xFF,


0x7F,0xFF,0xFF,0x00,0xFF,0x7E,0x7D,0x73,0x4F,0x3F,0x4F,0x73,0x7D,0x7E,0x7E,0xFF,


0xFF,0xFB,0xF7,0xEF,0x9F,0xFD,0xFE,0x01,0xFF,0xFF,0xBF,0xDF,0xEF,0xF3,0xFF,0xFF,


0xFF,0xFF,0xFF,0x4F,0x4F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};

[1] [2]
关键字:51单片机  LED  旋转显示器 引用地址:基于51单片机的LED旋转显示器制作

上一篇:51单片机复位电路原理介绍
下一篇:51单片机总线时序概述

小广播
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved