模拟手势控制屏程序.docx
- 文档编号:30067690
- 上传时间:2023-08-04
- 格式:DOCX
- 页数:31
- 大小:20.38KB
模拟手势控制屏程序.docx
《模拟手势控制屏程序.docx》由会员分享,可在线阅读,更多相关《模拟手势控制屏程序.docx(31页珍藏版)》请在冰豆网上搜索。
模拟手势控制屏程序
#include
#include
#include
#defineuintunsignedint
#defineucharunsignedchar
sbitre4=P2^3;//四个传感器
sbitre3=P2^1;
sbitre2=P3^5;
sbitre1=P3^6;
sbitled1=P3^3;//四只发光二极管
sbitled2=P1^5;
sbitled3=P3^7;
sbitled4=P2^2;
sbitBeep=P2^4;//蜂鸣器
unsignedcharn=0;//n为节拍常数变量
sbitCS=P1^0;//12864的cs,sid,sclk.
sbitSID=P1^1;
sbitSCLK=P1^2;
sbitdin=P2^7;//tlc5615的接口
sbitsclk=P2^6;
sbitcs=P2^5;
ucharcodead_table[6]={0xff,0xc0,0xb0,0xa0,0x8f,0x00};//AD的表
ucharcodedisps[]={"ILOVEMCU!
"};
ucharcodedispx[]={"我爱单片机!
"};
ucharcodedispname1[]={"制作者:
何通"};
ucharcodedispname2[]={"韩琦"};
ucharcodedispschool[]={"电子科技大学"};
ucharcodedispleftarrow[]={"<-----"};
ucharcodedisprightarrow[]={"----->"};
ucharnum,count;//中断计数用
intlight=601;//灯泡亮度的标志?
intlight1,light2;
voiddelay_1ms(uintms);//延时程序
voidstart_interrupt0();//启动中断1
voidstart_interrupt1();//启动中断2
voidstart_interrupt2();//启动附加中断
voidsend_command(ucharcommand_data);//12864液晶写命令程序
voidsend_data(ucharcommand_data);//12864液晶写数据程序
voidlcd_init();//液晶初始化
voidphotodisplay(uchar*bmp);//显示图形
voiddisplay_x();
voiddisplay_s();
voiddisplay_leftarrow();//显示箭头
voiddisplay_rightarrow();
voiddisplayname1();//显示名字
voiddisplayname2();//显示名字
voiddisplayschool();
voidwrite_5615(uintda);//向AD:
tlc-5615写数据
intad_lighted();//控制灯泡亮度
unsignedcharp,m;//m为频率常数变量
unsignedchari=0;//循环变量
voidbofangyinyue1();//八月桂花
voidbofangyinyue2();//祝你平安
voidlighted();//控制LED
voidlighted2();//控制灯
voidlight_off();//灭灯
/*********************************************/
//液晶的图片
charcodePhoto1[]={
0x00,0x00,0x00,0x04,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,0x01,0x3F,0xC0,
0x80,0x42,0x04,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x8A,0x1F,
0xFC,0x42,0x04,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,
0x01,0xFF,0xDE,0x88,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x2A,0x87,
0xF0,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0x84,
0x10,0xA2,0x0A,0x88,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,
0xFC,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x9F,0x90,
0x05,0x2F,0xCA,0xA4,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,
0xE1,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0xC2,
0x24,0x48,0x44,0x90,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x84,
0x24,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x58,
0x3D,0x0F,0xD0,0xC4,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1C,0xFF,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x23,0x08,0x37,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x10,0x08,0x40,0x00,0xFF,0x90,
0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,//液晶图片
0x00,0x81,0x86,0x10,0x40,0x00,0x08,0x08,
0x10,0xFF,0x86,0x00,0x00,0x00,0x00,0x00,
0x01,0x02,0x49,0x40,0x40,0x00,0x7F,0x0B,
0xFC,0x08,0x0F,0x00,0x00,0x00,0x00,0x00,
0x01,0x08,0x00,0x40,0x20,0x00,0x10,0x00,
0x10,0x49,0x0F,0x00,0x00,0x00,0x00,0x00,
0x02,0x08,0x00,0x20,0x20,0x01,0xFF,0xDD,
0x10,0x2A,0x0F,0x00,0x00,0x00,0x00,0x00,
0x04,0x31,0x83,0x20,0x20,0x00,0x20,0x04,
0x91,0xFF,0xC6,0x00,0x00,0x00,0x00,0x00,
0x04,0x52,0x44,0x90,0x20,0x00,0x7F,0x04,
0x90,0x1C,0x06,0x00,0x00,0x00,0x00,0x00,
0x09,0xA4,0x28,0x4C,0x10,0x00,0xA1,0x04,
0x10,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,
0x0E,0x44,0xE9,0xC3,0x90,0x01,0x3F,0x04,
0x70,0x49,0x06,0x00,0x00,0x00,0x00,0x00,
0x00,0x82,0xC5,0x81,0x70,0x00,0x21,0x0A,
0x01,0x88,0xC6,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x83,0x00,0x80,0x00,0x3F,0x11,
0xFC,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x0C,0x70,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x13,0x87,0x10,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x20,0x78,0xA0,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x20,0x00,0x60,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x21,0x80,0x60,0x40,0x00,0x00,0x71,
0xEE,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x11,0x98,0x90,0x80,0x00,0x00,0x8E,
0x31,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x08,0x18,0x80,0x80,0x00,0x01,0x24,
0x24,0x83,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x96,0x01,0x01,0x00,0x00,0x01,0x40,
0x28,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x49,0x86,0x03,0x00,0x00,0x01,0x40,
0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x34,0x78,0x8C,0x00,0x00,0x01,0x00,
0x20,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0E,0x01,0x30,0x00,0x00,0x00,0x80,
0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x71,0x87,0xCE,0x00,0x00,0x00,0x40,
0x68,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xE0,0x78,0x07,0x00,0x00,0x00,0x20,
0xC4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xAF,0xFF,0xC5,0x80,0x00,0x00,0x11,
0x82,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0xA9,0xB6,0x45,0xC0,0x00,0x00,0x0B,
0x01,0x60,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x2F,0x03,0xC4,0xE0,0x00,0x00,0x06,
0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x0E,0x16,0x01,0x88,0x70,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0x08,0x00,0x10,0xF0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0x84,0x00,0x21,0xF0,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,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,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,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,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,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,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,0x00,0x00,0x00,0x00,0x00
};
////////////////////////
/************************************************************************
[文件名]C51音乐程序(八月桂花)
[功能]通过单片机演奏音乐
/**********************************************************************/
//本例采用89C52,晶振为11.0592MHZ
//关于如何编制音乐代码,其实十分简单,各位可以看以下代码.
//频率常数即音乐术语中的音调,而节拍常数即音乐术语中的多少拍;
//所以拿出谱子,试探编吧!
unsignedcharcodemusic_tab[]={
0x18,0x30,0x1C,0x10,//格式为:
频率常数,节拍常数,频率常数,节拍常数,
0x20,0x40,0x1C,0x10,
0x18,0x10,0x20,0x10,
0x1C,0x10,0x18,0x40,
0x1C,0x20,0x20,0x20,
0x1C,0x20,0x18,0x20,
0x20,0x80,0xFF,0x20,
0x30,0x1C,0x10,0x18,
0x20,0x15,0x20,0x1C,
0x20,0x20,0x20,0x26,
0x40,0x20,0x20,0x2B,
0x20,0x26,0x20,0x20,
0x20,0x30,0x80,0xFF,
0x20,0x20,0x1C,0x10,
0x18,0x10,0x20,0x20,
0x26,0x20,0x2B,0x20,
0x30,0x20,0x2B,0x40,
0x20,0x20,0x1C,0x10,
0x18,0x10,0x20,0x20,
0x26,0x20,0x2B,0x20,
0x30,0x20,0x2B,0x40,
0x20,0x30,0x1C,0x10,
0x18,0x20,0x15,0x20,
0x1C,0x20,0x20,0x20,
0x26,0x40,0x20,0x20,
0x2B,0x20,0x26,0x20,
0x20,0x20,0x30,0x80,
0x20,0x30,0x1C,0x10,
0x20,0x10,0x1C,0x10,
0x20,0x20,0x26,0x20,
0x2B,0x20,0x30,0x20,
0x2B,0x40,0x20,0x15,
0x1F,0x05,0x20,0x10,
0x1C,0x10,0x20,0x20,
0x26,0x20,0x2B,0x20,
0x30,0x20,0x2B,0x40,
0x20,0x30,0x1C,0x10,
0x18,0x20,0x15,0x20,//音乐,八月桂花
0x1C,0x20,0x20,0x20,
0x26,0x40,0x20,0x20,
0x2B,0x20,0x26,0x20,
0x20,0x20,0x30,0x30,
0x20,0x30,0x1C,0x10,
0x18,0x40,0x1C,0x20,
0x20,0x20,0x26,0x40,
0x13,0x60,0x18,0x20,
0x15,0x40,0x13,0x40,
0x18,0x80,0x00
};
//祝你平安
unsignedcharcodemusic_tab2[]={
0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,0x10,0x20,0x80,0x26,0x20,0x30,0x20,
0x30,0x20,0x39,0x10,0x30,0x10,0x30,0x80,0x26,0x20,0x20,0x20,0x20,0x20,0x1c,0x20,
0x20,0x80,0x2b,0x20,0x26,0x20,0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x80,0x26,0x20,
0x30,0x20,0x30,0x20,0x39,0x10,0x26,0x10,0x26,0x60,0x40,0x10,0x39,0x10,0x26,0x20,
0x30,0x20,0x30,0x20,0x39,0x10,0x26,0x10,0x26,0x80,0x26,0x20,0x2b,0x10,0x2b,0x10,
0x2b,0x20,0x30,0x10,0x39,0x10,0x26,0x10,0x2b,0x10,0x2b,0x20,0x2b,0x40,0x40,0x20,
0x20,0x10,0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x18,0x20,0x18,0x20,0x26,0x20,
0x20,0x20,0x20,0x40,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,0x20,0x20,
0x20,0x80,0x1c,0x20,0x1c,0x20,0x1c,0x20,0x30,0x20,0x30,0x60,0x39,0x10,0x30,0x10,
0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x10,0x26,0x10,0x26,0x10,0x2b,0x10,0x2b,0x80,
0x18,0x20,0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x60,0x26,0x10,0x2b,0x20,0x30,0x20,
0x30,0x20,0x1c,0x20,0x20,0x20,0x20,0x80,0x26,0x20,0x30,0x10,0x30,0x10,0x30,0x20,
0x39,0x20,0x26,0x10,0x2b,0x10,0x2b,0x
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 模拟 手势 控制 程序