资源描述:
《51单片机应用实例小制作》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、51单片机应用实例小制作16x16点阵显示屏、蜂鸣器、独立键盘制作:赵建业2016/12/117原理图(总体)17原理图(芯片)17原理图(16x16LED点阵)功能说明:1、通电后进入问候界面。2、四个按键(实时有效):1>GIF:按下后进入动画显示模式。2>WORLD:按下后进入文字显示模式。3>MUSIC:按下后进入音乐模式,由于51硬件限制,暂时不能同时显示16x16点阵。4>NEXT:按下后,切换当前模式的下一个内容。为循环播放。3、滑动变阻器:音乐模式下调节音量大小。注意事项:1、程序代码由于在world中保存格式原因,复
2、制到编译软件后可能会出现错误。或可以向本人索要源代码。2、由于本程序内容较多,占用内存较大,89c51的内存放不下,因此需要用89c52或更高版本芯片。它们只是内存大小不容。17程序代码:main.c#include#include#include"yinfu.h"//自定义音符头文件#defineucharunsignedchar#defineuintunsignedint#defineulongunsignedlong#defineKEYP2sbitsound=P1^6;sbitMOSIO=
3、P1^0;sbitR_CLK=P1^1;sbitS_CLK=P1^2;unsignedcharKeymun1,Keymun2;//存按键序号unsignedcharKeystay;//按键状态,有按键按下为1,无按键按下为0unsignedintC;unsignedcharx,y;ucharcodetab0[]={0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x
4、08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x80,0x00};ucharcodehi[]={0,0,0,0,0,0,3,12,2,12,2,0,2,0,58,14,70,8,66,8,66,8,66,8,66,8,231,62,0,0,0,0};//开机问候语:“hi”ucharcodejif1[22][32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,1,128,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19
5、2,3,64,2,64,2,192,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,7,32,4,160,5,160,5,32,4,224,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,15,16,8,208,11,80,10,80,10,208,11,16,8,240,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,31,8,16,232,23,40,20,168,21,168,21,40,20,232,23,8,16,2
6、48,31,0,0,0,0,0,0,0,0,0,0,252,63,4,32,244,47,20,40,212,43,84,42,84,42,212,43,20,40,244,47,4,32,252,63,0,0,0,0,0,0,254,127,2,64,250,95,10,80,234,87,42,84,170,85,170,85,42,84,234,87,10,80,250,95,2,64,254,127,0,0,255,255,1,128,253,191,5,160,245,175,21,168,213,171,85,170,85
7、,170,213,171,21,168,245,175,5,160,253,191,1,128,255,255,128,1,128,1,128,1,128,1,128,1,128,1,128,1,255,255,255,255,128,1,128,1,128,1,128,1,128,1,128,1,128,1,1,128,3,192,6,96,12,48,24,24,48,12,96,6,192,3,128,1,192,3,96,6,48,12,24,24,12,48,6,96,3,192,128,1,128,1,128,1,128,
8、1,128,1,128,1,128,1,255,255,255,255,128,1,128,1,128,1,128,1,128,1,128,1,128,1,1,128,3,192,6,96,12,48,24,24,48,