工业控制 | 能源技术 | 汽车电子 | 通信网络 | 安防监控 | 智能电网 | 移动手持 | 无线技术 | 家用电器 | 数字广播 | 消费电子 | 应用软件 | 其他方案

电路设计->综合电路图->综合电路图->led摇摇棒的制作

led摇摇棒的制作

作者:dolphin时间:2016-10-14

  LED摇摇棒很好地利用了人眼的视觉暂留特性。摇摇棒配合手的左右摇晃就可呈现一幅完整的画面,可以显示字符、图片等。
  led摇摇棒电路原理图led摇摇棒电路原理图
led摇摇棒的制作

led摇摇棒的制作

led摇摇棒的制作
/******************************************** 摇摇棒显示程序(10个切换) *
* 设计者:贺显云 *
* 设计时间:2010年10月15日 *
* QQ:513696765 *
*******************************************/
#includereg52.h
#define unchar unsigned char
#define unint unsigned int
int i,j;
sbit key=P2^7;
int k;
//************延时函数****************
void delay(unchar xms)
{
unchar m,n;
for(m=0;mxms;m++)
for(n=0;n150;n++);
}
//************键盘检测*************
void keyscan()
{
if(key==0)
{
delay(10);
if(key==0)
{
k++;
while(!key);
if(k10)
k=0;
}
}
}
//*****************************************
unsigned char code table_0[]={
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,
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,
0xf7,0xff,0xf7,0xff,0x00,0x01,0xf7,0xff,
0xf7,0xff,0xf7,0x3d,0xec,0xfb,0xef,0xe7,
0xef,0x1f,0x00,0xff,0xef,0xfb,0xef,0xfd,
0xe0,0x03,0xfe,0xff,0xff,0x3f,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xfd,0xbd,0xfb,0xb8,
0xf5,0xb5,0xed,0xad,0xdd,0x9d,0x3d,0xb9,
0xdd,0xbb,0xed,0xbb,0xf5,0xab,0xfb,0xb0,
0xf9,0xb9,0xfc,0xff,0xfd,0xff,0xff,0xff}; //显示电子协会的字模
unsigned char code table_1[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xd7,0xfb,0xdb,0xf7,0xdd,0xcd,0xde,0x3d,
0xd9,0x3d,0xc7,0xcb,0xfb,0xfb,0xe7,0xf7,
0x0f,0xcf,0xe8,0x3f,0xef,0x9f,0xef,0xe7,
0xeb,0xf3,0xe7,0xf9,0xef,0xfb,0xff,0xff,
0xfd,0xfd,0x7d,0xfb,0x8c,0x07,0xdf,0xfb,
0xff,0xfd,0xc0,0x1d,0xdf,0xbd,0xbf,0x7d,
0xbf,0xfd,0xc0,0x05,0xdf,0xfd,0xdf,0xbd,
0xdf,0xdd,0xc0,0x3d,0xff,0xfd,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //显示欢迎你的字模

unsigned char code table_2[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
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,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xfd,0xff,0xfd,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,
0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //显示★的字模

unsigned char code table_3[]={
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xf1,0xff,0xff,0xff,0x00,0x00,0xef,0xff,
0xf2,0xfe,0xee,0xfd,0xee,0xf3,0xee,0x8f,
0x00,0x7f,0xee,0x9f,0xee,0xef,0xee,0xf3,
0xe0,0xf9,0xfe,0xfc,0xfe,0xfd,0xff,0xff,
0xff,0xff,0xff,0xfb,0xfd,0xe7,0xc0,0xcf,
0xdd,0x1f,0xdd,0xb7,0xdd,0xfb,0x9d,0xfd,
0xa0,0x03,0xbd,0xff,0x3d,0xff,0x3d,0xbf,
0xbd,0xcf,0xfd,0xe3,0xff,0xf7,0xff,0xff}; //显示天天快乐的字模
unsigned char code table_4[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf8,0x0f,0xf7,0xf7,0xef,0xfb,0xef,0xfb,
0xf7,0xf7,0xf8,0x0f,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf7,0xfb,0xf7,0xfb,0xe0,0x03,0xff,0xfb,
0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf1,0xf3,0xef,0xeb,0xef,0xdb,0xef,0xbb,
0xee,0x7b,0xf1,0xf3,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf3,0xe7,0xef,0xfb,0xee,0xfb,0xee,0xfb,
0xed,0x77,0xf3,0x8f,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //显示0123的字模
unsigned char code table_5[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0x7f,0xfe,0x7f,0xfe,0x00,0x00,
0x00,0x00,0x7f,0xfe,0x7f,0xfe,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,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,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,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};// 显示I ? U的字模
unsigned char code table_6[]={
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,
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};//显示电子技术的字模
unsigned char code table_7[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,
0xbf,0xfb,0xbe,0xfb,0xbe,0xfb,0xbe,0xfb,
0xbe,0xfb,0xbe,0xfb,0x80,0x03,0xbe,0xfb,
0xbe,0xfb,0xbe,0xfb,0xbe,0xfb,0x3c,0xfb,
0xbe,0xf3,0xff,0xfb,0xff,0xff,0xff,0xff,
0xff,0xff,0xc0,0x1f,0xef,0xbf,0xef,0xbf,
0xef,0xbf,0xef,0xbf,0x00,0x00,0xef,0xbf,
0xef,0xbf,0xef,0xbf,0xef,0xbf,0xc0,0x1f,
0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,
0xbf,0xfb,0xbe,0xfb,0xbe,0xfb,0xbe,0xfb,
0xbe,0xfb,0xbe,0xfb,0x80,0x03,0xbe,0xfb,
0xbe,0xfb,0xbe,0xfb,0xbe,0xfb,0x3c,0xfb,
0xbe,0xf3,0xff,0xfb,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//显示王中王的字模
unsigned char code table_8[]={
0xff,0xff,0xff,0xff,0x80,0x00,0xb6,0xfd,
0xb6,0xfb,0xb6,0xf7,0xb6,0xff,0xb0,0xff,
0xb6,0x3f,0xb6,0xcf,0xb6,0xf7,0x86,0xfb,
0xfe,0xfd,0xfe,0xf0,0xff,0xff,0xff,0xff,
0xdf,0xfb,0xd8,0x03,0xdf,0xf7,0xdf,0xf7,
0xc0,0x0d,0xdd,0xed,0xdd,0x5d,0xdc,0xfb,
0xf2,0xfb,0x07,0x37,0xb7,0xcf,0xf7,0x37,
0xf0,0xfb,0xf7,0xf9,0xf7,0xfb,0xff,0xff,
0xfd,0xff,0xf3,0xbf,0xf7,0xbf,0xb7,0xbf,
0xc5,0xbf,0xd5,0xbf,0xf5,0xbd,0x75,0xbe,
0x85,0x01,0xd4,0xbf,0xf5,0xbf,0xe7,0xbf,
0x15,0xbf,0xb3,0xbf,0xf7,0xbf,0xff,0xff,
0x80,0x00,0xbf,0xff,0xb3,0xbf,0xad,0xdf,
0x9e,0x3e,0xcf,0x7d,0xdb,0x73,0xdb,0x0f,
0x5b,0x7f,0x9b,0x7f,0xdb,0x01,0xdb,0x7e,
0xdb,0x7e,0xcf,0x7e,0xdf,0x70,0xff,0xff};//显示民政学院的字模
unsigned char code table_9[]={
0xff,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfc,0xff,0xfe,0xff,0xff,0xff,
0xff,0x7f,0xfe,0xfd,0xf9,0xfd,0x87,0x7d,
0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,
0x00,0x01,0xb7,0x7d,0xf7,0x7d,0xf7,0x7d,
0xe6,0x7d,0xf7,0x79,0xff,0xfd,0xff,0xff,
0xff,0xbf,0xdf,0x7f,0xde,0xff,0xdd,0xff,
0xd8,0x00,0xd3,0x6f,0xcb,0x6f,0x1b,0x6f,
0xdb,0x6b,0xdb,0x6d,0xdb,0x6c,0xd8,0x01,
0xdf,0xff,0xdf,0xff,0xdf,0xff,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff};//显示一生有你的字模
unsigned char code table_10[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
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,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//显示(^-^)的字模

//***************显示函数****************
void xianshi()
{
for(i=0,j=1;i=127,j=128;i=i+2,j=j+2)
{
if(k==0)
{
P1=table_0[i],P3=table_0[j]; //显示电子协会
delay(1);
}

else if(k==1)
{
P1=table_1[i],P3=table_1[j]; //显示欢迎你
delay(1);
}

else if(k==2)
{
P1=table_2[i],P3=table_2[j]; //显示★
delay(1);
}

else if(k==3)
{
P1=table_3[i],P3=table_3[j]; //显示天天快乐
delay(1);
}

else if(k==4)
{
P1=table_4[i],P3=table_4[j]; //显示0123
delay(1);
}

else if(k==5)
{
P1=table_5[i],P3=table_5[j]; // 显示I ? U
delay(1);
}

else if(k==6)
{
P1=table_6[i],P3=table_6[j]; //显示电子技术
delay(1);
}

else if(k==7)
{
P1=table_7[i],P3=table_7[j]; //显示王中王
delay(1);
}

else if(k==8)
{
P1=table_8[i],P3=table_8[j]; //显示民政学院
delay(1);
}

else if(k==9)
{
P1=table_9[i],P3=table_9[j]; //显示一生有你
delay(1);
}

else if(k==10)
{
P1=table_10[i],P3=table_10[j]; //显示(^-^)
delay(1);
}

}
}


//****************主函数*******************************
void main(void)
{
while(1)
{
keyscan();
xianshi();
}
}


技术资讯 技术方案 技术应用 技术新品 技术前沿 行业资讯 行业方案 行业应用 行业新品 行业前沿


评论

技术专区