摇摇棒制作资料讲解

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

LED摇摇棒的详细制作资料

LED摇摇棒很好地利用了人眼的视觉暂留特性。下图是基于51单片机控制、16只高亮度LED发光二极管构成的摇摇棒,配合手的左右摇晃就可呈现一幅完整的画面,可以显示字符、图片等。演示效果见自制LED摇摇棒展示【图】。

黑暗条件下拍摄的效果图片:

实物外形图:

基本原理与硬件电路设计:

16只LED发光管作为画面每一列的显示,左右摇晃起到了扫描的作用,人眼的视觉暂留现象使得看到的是一幅完整的画面。与LED点阵的显示有几分相仿。

硬件电路如下图(点击可放大)。系统电源VCC为5V,下载程序和调试时一定要保证5V电压,实际使用时用3节干电池串联即可。AT89S52单片机作为控制器,在它的P0、P2口接有16只以共阳的方式连接的高亮度LED,由单片机输出低电平点亮。P0口的上拉电阻RA1不能少。串在LED公共端的二极管D1会产生一定的压降,用来保护LED,经实测LED点亮时两端电压为3V左右,在LED的安全承受范围内。K1是画面切换开关,用于切换显示不同内容;S1为水银开关。

水银开关的作用:棒在摇动时,只能在朝某一方向摇动时显示,否则会出现镜像字或镜像画面,所以通过接一只水银开关来控制,使摇摇棒从左向右摇动时将内容显示出来。

硬件制作:

使用的是直径5mm的红色高亮LED,感觉太大了些,远看效果很好但近看时字不够连贯。建议使用直径为3mm的高亮LED,颜色可根据个人喜好选择。

水银开关里的水银珠很活跃,导致在接通时容易产生抖动,所以将水银开关斜向上放置(尖尖朝斜上方45°角),靠水银珠自身重力的作用减少抖动:

IC座里面隐藏元件,既美观又能保护元件:

软件设计:

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

程序名称:LED摇摇棒显示64*16像素

简要说明:外部中断方式INT0显示;取模方式:纵向取模、字节倒序

编写:

最后更新:08/11/15晚

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

#include <>

#define uchar unsigned char

#define uint unsigned int //宏定义

#define KEY P3_0 //定义画面切换按键

uchar KY; //KY作用在后面说明

uchar disp; //显示汉字指针

uchar pic=0,num=0; //pic为按键次数;num为中断次数

uchar code love[] = {

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x20,0x00,0x20,0x00,0x2 0,

0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x0 F,

0x04,0x10,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x04,0x10,0xF8,0x0F,0x00,0x0 0,

0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x1 0,

0x00,0x08,0xFE,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x82,0x20,0x82,0x2 0,

0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,/*LOVE*/

};

uchar code loveyou[] = {

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0

0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x78,0x00,0xFC,0x00,0xFE,0x01,0xFE,0x03,0xFE,0x07,0xFE,0x0F,0xFE,0x1F,0xFC,0x3F, 0xF8,0x7F,0xFC,0x3F,0xFE,0x1F,0xFE,0x0F,0xFE,0x07,0xFE,0x03,0xFE,0x01,0xFC,0x00, 0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,/*心形图案*/

};

uchar code hehe[] = {

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x40,0x01,0xC0,0x01,0x00,0x00,0x00,0x0 0,

0xF0,0x0F,0x08,0x10,0x04,0x20,0x00,0x00,0x00,0x00,0xF0,0x3F,0x08,0x00,0x04,0x0 0,

0x04,0x00,0x04,0x00,0x08,0x00,0xF0,0x3F,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x2 0,

0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0xF0,0x3F,0x08,0x00,0x04,0x0 0,

0x04,0x00,0x04,0x00,0x08,0x00,0xF0,0x3F,0x00,0x00,0x00,0x00,0x04,0x20,0x08,0x1 0,

0xF0,0x0F,0x00,0x00,0x00,0x00,0xC0,0x01,0x40,0x01,0xC0,0x01,0x00,0x00,0x00,0x0 0,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,/*呵呵o(∩_∩)o图案*/

};

相关文档
最新文档