资源描述:
《LED摇摇棒制作套件.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、电路说明:本电路采用16只LED作为画面每一列的显示,左右摇晃起到了扫描的作用,人眼的视觉暂留现象使得看到的是一幅完整画面,与LED点阵的显示相仿。电路中AT89S51单片机为控制器,在它的P0、P2口接有16只以共阳的方式连接的高亮度LED,由单片机输出低电平点亮。S1为滚珠开关,棒在摇动时,只能在朝某一方向摇动时显示,否则会出现镜像字或镜像画面,所以通过接一只滚珠开关来控制,使摇摇棒从左向右摇动时将内容显示出来;S2是画面切换开关,单片机中已经写入能显示多个画面的程序,工作时通过这个开关来切换。注意:安装滚珠开关S1时,要注意其引脚方向,如果装反了显示的画面会出现镜像。
2、AT89S51AAA元件清单元件清单软件设计软件设计软件设计软件设计::::**********************************************************/#include#defineusherunsignedchar#defineuintunsignedint//宏定义#defineKEYP3_0//定义画面切换按键ucharKY;//KY作用在后面说明uchardisp;//显示汉字指针ucharpic=0,num=0;//pic为按键次数;num为中断次数ucharcodelove[]={0x00,0x00
3、,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x0F,0x04,0x10,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x04,0x10
4、,0xF8,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x08,0xFE,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
5、,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*LOVE*/};ucharcodeloveyou[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
6、,0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00
7、,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*心形图案*/};ucharcodehehe[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x