基于51单片机的LED显示棒制作Word下载.docx

上传人:b****3 文档编号:17554972 上传时间:2022-12-07 格式:DOCX 页数:13 大小:120.74KB
下载 相关 举报
基于51单片机的LED显示棒制作Word下载.docx_第1页
第1页 / 共13页
基于51单片机的LED显示棒制作Word下载.docx_第2页
第2页 / 共13页
基于51单片机的LED显示棒制作Word下载.docx_第3页
第3页 / 共13页
基于51单片机的LED显示棒制作Word下载.docx_第4页
第4页 / 共13页
基于51单片机的LED显示棒制作Word下载.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

基于51单片机的LED显示棒制作Word下载.docx

《基于51单片机的LED显示棒制作Word下载.docx》由会员分享,可在线阅读,更多相关《基于51单片机的LED显示棒制作Word下载.docx(13页珍藏版)》请在冰豆网上搜索。

基于51单片机的LED显示棒制作Word下载.docx

五、电路原理图及说明

系统电源VCC为5V,本款摇摇棒采用9V电池电源转换为5V电源供电。

STC89C52单片机作为控制器,在它的P1、P3口接有16只以共阳的方式连接的高亮度LED,由单片机输出低电平点亮。

8、9管脚外接复位电路,P2口28管脚外接字幕切换按键,40管脚接自锁开关,28、29管脚外接时钟电路。

LED显示棒PCB板

为了便于携带以及摇摆设计板材尺寸为2cm*20cm。

六、LED显示棒程序流程图

六、LED显示棒程序代码及说明

程序代码(见附表)

以线阵排列的16个led有两组十六进制代码组成。

将字幕代码分别送给P1、P3。

每个字幕有16*16点阵组成,在单片机中存储好四个字幕代码数组,如此往复在摇摇棒经过区域形成一个64*16的点阵屏。

实现显示效果。

七、LED显示棒使用说明及注意事项

1、按下电源开关,手握摇摇棒下部以适当的频率左右摇摆,线阵排列的16个LED灯所经过的区域即可出现字幕或图案。

2、按下切换键即可摇摆出另一幅字母或图案。

3、按下复位键即可从头开始显示所摇摆出的字母或图案。

4、使用完毕关闭电源开关即可。

A、系统电源VCC为5V,下载程序和调试时一定要保证5V电压。

B、本款摇摇棒16个LED灯采用共阳极连接。

摇摇棒程序代码

#include<

reg52.h>

#defineuncharunsignedchar

#defineunintunsignedint

inti,j;

sbitkey=P2^7;

intk;

//************延时函数****************

voiddelay(uncharxms)

{

uncharm,n;

for(m=0;

m<

xms;

m++)

for(n=0;

n<

150;

n++);

}

//************键盘检测*************

voidkeyscan()

if(key==0)

{

delay(10);

if(key==0)

{

k++;

while(!

key);

if(k>

10)

k=0;

}

}

//*****************************************

unsignedcharcodetable_0[]={

0xff,0xfb,0xff,0xfb,0xff,0xf3,0xff,0xc3,

0xff,0x1b,0xfc,0x3b,0xf1,0xbf,0xe7,0xbf,

0xe3,0xbf,0xe0,0xbf,0xf8,0x1b,0xfe,0x03,

0xff,0x83,0xff,0xe3,0xff,0xfb,0xff,0xfb,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,};

//显示"

A"

的字模

unsignedcharcodetable_1[]={

0xff,0xff,0xff,0xff,0xe0,0x0f,0xed,0xdf,

0xed,0xdf,0xed,0xdf,0xed,0xdf,0x00,0x03,

0xed,0xdd,0xed,0xdd,0xed,0xdd,0xed,0xdd,

0xe0,0x0d,0xff,0xfd,0xff,0xf1,0xff,0xff,

电"

unsignedcharcodetable_2[]={

0xff,0xff,0xff,0xff,0xf0,0x3f,0xef,0xdf,

0xdf,0xef,0xdf,0xef,0xdf,0xef,0xdf,0xef,

0xdf,0xef,0xdf,0x03,0xde,0xed,0xdd,0xee,

0xee,0xdd,0xf0,0x3e,0xfd,0xfe,0xfd,0xfe,

0xed,0xde,0xf0,0x3e,0xfd,0xfe,0xfd,0xfe,

0xf0,0x3e,0xed,0xde,0xde,0xed,0xdf,0x03,

0xdf,0x03,0xde,0xed,0xed,0xde,0xf0,0x3e,

0xed,0xde,0xdd,0xee,0xde,0xed,0xdf,0x03,

0xdf,0xef,0xef,0xdf,0xf0,0x3f,0xff,0xff,

0xf0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,

奥运五环的字模

unsignedcharcodetable_3[]={

0xff,0xff,0xef,0xff,0xe1,0xff,0xe0,0x1f,

0xee,0x03,0xff,0xe3,0xef,0x0f,0xe0,0x7f,

0xe0,0x7f,0xe0,0x07,0xff,0x03,0xff,0x87,

0xec,0x3f,0xe1,0xff,0xe7,0xff,0xef,0xff,

0xff,0xff,0xf8,0x3f,0xf6,0xdf,0xf6,0xdf,

0xf6,0xdf,0xf6,0xdf,0xf9,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0x00,0x07,0xff,0xfb,

0xff,0xfb,0xff,0xe7,0xff,0xff,0xff,0xff,

0xfc,0x3f,0xfb,0xdf,0xf7,0xef,0xf7,0xef,

0xf7,0xef,0xff,0xff,0xff,0xff,0xfc,0x3f,

0xfb,0xdf,0xf7,0xef,0xf7,0xef,0xf7,0xef,

0xfb,0xdf,0xfc,0x3f,0xff,0xff,0xff,0xff,

0xff,0xff,0xf8,0x1f,0xf7,0xff,0xf7,0xff,

0xf8,0x3f,0xf7,0xff,0xf7,0xff,0xf8,0x1f,

0xff,0xff,0xff,0xff,0xf8,0x3f,0xf6,0xdf,

0xf6,0xdf,0xf6,0xdf,0xf8,0xbf,0xff,0xff,};

welcome的字模

unsignedcharcodetable_4[]={

0xf7,0xdf,0xbb,0xdf,0xd9,0x80,0xcf,0x8f,

0xf1,0xff,0xde,0xfd,0xde,0xfb,0xcd,0x07,

0x55,0xff,0x9b,0xff,0xd5,0xff,0xcd,0x00,

0xde,0xff,0x9f,0x8f,0xdf,0xff,0xff,0xff,

0xf5,0xff,0xcd,0xff,0xdd,0xff,0xdd,0xff,

0xdd,0xff,0xdd,0xfd,0x5d,0xfe,0x9c,0x01,

0xdd,0xff,0xdd,0xff,0xdd,0xff,0xdd,0xff,

0xdd,0xff,0xd5,0xff,0xcd,0xff,0xff,0xff,};

济宁"

unsignedcharcodetable_5[]={

0xdf,0x0f,0x9f,0x3f,0x5f,0x9f,0xdf,0xcf,

0xdf,0x0f,0xc2,0x7f,0x58,0xff,0x58,0xff,

0x5a,0x3f,0xc3,0x1f,0xdf,0xc7,0xdf,0xf7,

0xdf,0xf7,0x9f,0xe7,0xbf,0xff,0xff,0xff,

//显示"

北京奥运会微”的字模

unsignedcharcodetable_6[]={

0xff,0x7f,0xff,0x7f,0xbf,0x7f,0xbf,0x7f,

0xbf,0x7f,0xbf,0x7d,0xbf,0x7e,0xb8,0x01,

0xb7,0x7f,0xaf,0x7f,0x9f,0x7f,0xbf,0x7f,

0xff,0x7f,0xfe,0x7f,0xff,0x7f,0xff,0xff,

0xef,0x7f,0xef,0x7d,0xee,0xfe,0x00,0x01,

0xed,0xff,0xeb,0xfd,0xff,0xfd,0xec,0xfb,

0xed,0x37,0xed,0xcf,0x01,0xcf,0xed,0xb7,

0xec,0x7b,0xed,0xf9,0xef,0xfb,0xff,0xff,

0xf7,0xf7,0xf7,0xf7,0xf7,0xef,0xf7,0xdf,

0xf7,0xbf,0xf6,0x7f,0xf5,0xff,0x00,0x01,

0xf5,0xff,0xf6,0xff,0xb7,0x7f,0xd7,0x9f,

0xf7,0xcf,0xf7,0xe7,0xf7,0xef,0xff,0xff};

//显示"

电子技术"

的字模

unsignedcharcodetable_7[]={

0xff,0xff,0xff,0xff,0xfd,0xff,0xfd,0xff,

0xfc,0xfd,0xfc,0x63,0xfc,0x03,0xf8,0x07,

0xc0,0x07,0x00,0x0f,0xc0,0x07,0xf8,0x07,

0xfc,0x03,0xfc,0x63,0xfc,0xfd,0xfd,0xff,

0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xfc,0xfd,0xfd,0x63,0xfd,0x9b,0xfb,0xf7,

0xc7,0xf7,0x3f,0xef,0xc7,0xf7,0xfb,0xf7,

0xfd,0x9b,0xfd,0x63,0xfc,0xfd,0xfd,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};

★"

unsignedcharcodetable_8[]={

0xf8,0x0f,0xf7,0xf7,0xef,0xfb,0xef,0xfb,

0xf7,0xf7,0xf8,0x0f,0xff,0xff,0xff,0xff,

0xf7,0xfb,0xf7,0xfb,0xe0,0x03,0xff,0xfb,

0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,

0xf1,0xf3,0xef,0xeb,0xef,0xdb,0xef,0xbb,

0xee,0x7b,0xf1,0xf3,0xff,0xff,0xff,0xff,

0xf3,0xe7,0xef,0xfb,0xee,0xfb,0xee,0xfb,

0xed,0x77,0xf3,0x8f,0xff,0xff,0xff,0xff,

0123"

unsignedcharcodetable_9[]={

0xff,0xff,0x7f,0xfe,0x7f,0xfe,0x00,0x00,

0x00,0x00,0x7f,0xfe,0x7f,0xfe,0xff,0xff,

0xff,0xff,0xff,0xff,0xf1,0xff,0xe0,0xff,

0xc0,0x7f,0x80,0x3f,0x00,0x1f,0x00,0x0f,

0x00,0x07,0x80,0x03,0xc0,0x01,0xf0,0x00,

0xc0,0x01,0x80,0x03,0x00,0x07,0x00,0x0f,

0x00,0x1f,0x80,0x3f,0xc0,0x7f,0xe0,0xff,

0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0x00,0x03,0x00,0x01,

0x00,0x01,0xff,0xf8,0xff,0xf8,0xff,0xf8,

0xff,0xf8,0xff,0xf8,0xff,0xf8,0xff,0xf8,

0xff,0xf8,0x00,0x00,0x00,0x01,0x00,0x03,

I?

U"

unsignedcharcodetable_10[]={

0xff,0xff,0xf8,0x1f,0xe7,0xe7,0xdf,0xfb,

0xbf,0xfd,0x7f,0xfe,0x7f,0xfe,0xff,0xff,

0xff,0xef,0xc1,0xdf,0xbf,0xaf,0x7f,0xe7,

0xbf,0xf3,0xc1,0xf1,0xff,0xf1,0xff,0xf1,

0xff,0xf1,0xff,0xf1,0xff,0xf1,0xc1,0xf1,

0xbf,0xf3,0x7f,0xe7,0xbf,0xaf,0xc1,0xdf,

0xff,0xef,0xff,0xff,0x7f,0xfe,0x7f,0xfe,

0xbf,0xfd,0xdf,0xfb,0xe7,0xe7,0xf8,0x1f,

(^-^)"

//***************显示函数****************

voidxianshi()

for(i=0,j=1;

i<

=127,j<

=128;

i=i+2,j=j+2)

if(k==0)

P1=table_0[j],P3=table_0[i];

delay

(2);

elseif(k==1)

P1=table_1[j],P3=table_1[i];

elseif(k==2)

P1=table_2[j],P3=table_2[i];

elseif(k==3)

P1=table_3[j],P3=table_3[

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1