STC11F04单片机制作的32灯摇摇棒
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
STC11F04单片机制作的32灯摇摇棒
说到摇摇棒,大家应该不陌生,但这款摇摇棒,用
了一片20脚的STC11F04单片机,控制32只发光二极管,能显示13组左右的字或者图片,能显示高32宽64的图像和字体任意,开机后自动切换每一组字,按了一下背
部的开关后变成手动切换!能根据自己的喜好用字模软
件编写各种各样的字体和图片,方法很简单!只要有单
片机的一点基础就可以随意的玩耍,送给朋友和喜欢的
人是件不错的礼物哦!此摇摇棒其实是没限制的,可以
显示高32宽很长的字和图片,只不过麻烦的是要手晃得大一点而已!所以通常都限制在合适的范围!资料来源
于网络,作者:张国荣。
#include ;
/*********外部接口定义**********/ #define uchar unsigned char
#define uint unsigned int
//宏定义
#define out P1 //数据输出端口
sbit led1=P3^0; //第1组LED
sbit led2=P3^1; //第2组LED
sbit led3=P3^3; //第3组LED
sbit led4=P3^4; //第4组LED
sbit key1=P3^5; //按键输入
sbit p3_2=P3^2;
uchar KY;
//KY作用在后面说明
uchar BUFF;
//缓存
/*********全局变量定义**********/
unsigned long int TimeCount=0;
unsigned int DelayN=80, //延时临时计数
DelayTime=80; //每次延时的周期个数
unsigned char key;
/**********************************************/ void delay(unsigned char n);
void DelayMs(void);
/*******************************************/ unsigned char code text1[] = {
0xEF,0x7F,0xEF,0xBC,0x0F,0xDD,0xE0,0xEB,0xEF,0xF3 ,0x0F,0x8C,0x7F,0xDF,0x7D,0xFF,0x7D,0xBF,0x7D,0x7 F,0x0D,0x80,0x75,0xFF,0x79,0xFF,0x7D,0xFF,0x7F,0x
FF,0xFF,0xFF,/*"好",0*/
0xEF,0x7F,0xEF,0xBC,0x0F,0xDD,0xE0,0xEB,0xE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