




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
基于51单片机的按键切换播放音乐原理图:引脚说明:共5个按键,分别接51单片机的P0P4引脚,前4个按键控制播放设置好的四首音乐,第5个按键用来关闭音乐。按键采用中断方式,任意时刻按下任意按键则立即进入所按按键的功能;蜂鸣器接单片机的P3.6口。仿真说明:使用proteus仿真,晶振:12MHZ。程序代码如下:/*12Mhz晶振工作*/#include #define uint unsigned int#define uchar unsigned charsbit voice=P36;uchar code sound1=0xff,0x40,0x80,0x30,0x40,0x2b,0x40,0x26,0x80,0x24,0x10,0x26,0x40,0x30,0x40,0x2b,0x80,0x30,0x40,0x39,0x40,0x30,0xc0,0x40,0x80,0x30,0x40,0x2b,0x40,0x26,0x40,0x26,0x20,0x24,0x20,0x20,0x40,0x30,0x40,0x24,0x80,0x26,0x10,0x20,0x40,0x2b,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x2b,0xc0,0x26,0x80,0x20,0x40,0x19,0x40,0x19,0x80,0x1c,0x10,0x1c,0x80,0x20,0x40,0x20,0x20,0x1c,0x20,0x19,0x40,0x1c,0x20,0x20,0x20,0x26,0xc0,0x24,0x80,0x24,0x10,0x20,0x40,0x1c,0x40,0x20,0x40,0x24,0x20,0x26,0x20,0x2b,0x80,0x33,0x40,0x33,0x20,0x39,0x20,0x40,0x40,0x39,0x40,0x30,0xc0,0x18,0x80,0x1c,0x80,0x24,0x80,0x20,0x10,0x1c,0x80,0x19,0x40,0x19,0x20,0x19,0x20,0x19,0x40,0x1c,0x20,0x20,0x20,0x26,0xc0,0x18,0x80,0x1c,0x80,0x24,0x80,0x20,0x10,0x1c,0x80,0x1c,0x40,0x1c,0x20,0x1c,0x20,0x1c,0x40,0x24,0x20,0x26,0x20,0xff,0x20,0x00;/同一首歌*/uchar code sound2=0xff,0x18,0x40,0x1c,0x20,0x18,0x20,0x13,0x40,0x13,0x20,0x15,0x20,0x13,0x20,0x15,0x20,0x13,0x20,0x15,0x20,0x18,0x20,0x19,0x20,0x1c,0x20,0x20,0x20,0x1c,0x40,0x19,0x20,0x18,0x20,0x15,0x40,0x10,0x80,0x13,0x10,0x10,0x40,0x15,0x10,0x13,0x10,0x18,0x10,0x1c,0x10,0x26,0x10,0x13,0x10,0x18,0x10,0x1c,0x10,0x26,0x10,0x13,0x10,0x18,0x10,0x1c,0x10,0x26,0x10,0x13,0x10,0x18,0x10,0x1c,0x10,0x26,0x10,0x15,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x15,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x15,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x15,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x18,0x10,0x1c,0x10,0x24,0x10,0x30,0x10,0x18,0x10,0x1c,0x10,0x24,0x10,0x30,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x19,0x10,0x19,0x10,0x20,0x10,0x2b,0x10,0x19,0x10,0x18,0xc0,0xff,0x40,0x40,0x10,0x39,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x40,0x30,0x10,0x30,0x20,0x39,0x20,0x30,0x40,0x2b,0x10,0x2b,0x20,0x26,0x20,0x26,0x80,0x40,0x10,0x39,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x40,0x2b,0x10,0x2b,0x20,0x2b,0x20,0x2b,0x40,0x30,0x10,0x30,0x20,0x39,0x20,0x2b,0x80,0x40,0x10,0x39,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x26,0x20,0x1c,0x20,0x1c,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x40,0x30,0x10,0x30,0x20,0x39,0x20,0x30,0x40,0x2b,0x10,0x2b,0x20,0x26,0x20,0x20,0x80,0x40,0x10,0x39,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x26,0x20,0x26,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x2b,0x40,0x2b,0x10,0x2b,0x20,0x2b,0x20,0x2b,0x40,0x30,0x10,0x30,0x20,0x39,0x20,0x30,0x80,0x30,0x10,0x18,0x20,0x19,0x20,0x18,0x20,0x1c,0x20,0x18,0x40,0x1c,0x10,0x1c,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x26,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x1c,0x40,0x1c,0x10,0x1c,0x20,0x1c,0x20,0x1c,0x40,0x20,0x10,0x20,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x26,0x40,0xff,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x1c,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x18,0x40,0x18,0x10,0x18,0x20,0x18,0x20,0x18,0x40,0x1c,0x10,0x1c,0x20,0x18,0x20,0x1c,0x80,0x20,0x10,0x20,0x20,0x30,0x20,0x18,0x20,0x19,0x20,0x18,0x20,0x19,0x20,0x1c,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x26,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x1c,0x40,0x1c,0x10,0x1c,0x20,0x1c,0x20,0x1c,0x40,0x20,0x10,0x20,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x26,0x40,0xff,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x2b,0x20,0x26,0x20,0x1c,0x20,0x26,0x20,0x2b,0x20,0x30,0x20,0x18,0x80,0xff,0x40,0xff,0x40,0xff,0x20,0x18,0x20,0x1c,0x20,0x18,0x20,0x1c,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1c,0x20,0x20,0x20,0x26,0x20,0x2b,0x20,0x26,0x20,0x2b,0x20,0x2b,0x20,0x30,0x20,0x39,0x20,0x30,0x20,0x30,0x20,0x2b,0x20,0x30,0xc0,0x30,0x80,0x30,0x20,0x18,0x20,0x1c,0x20,0x18,0x20,0x15,0x20,0x18,0x20,0x18,0x20,0x18,0x20,0x15,0x20,0x18,0x20,0x18,0x20,0x18,0x20,0x15,0x20,0x18,0x20,0x1c,0x20,0x18,0x20,0x13,0x20,0x15,0x20,0x15,0x20,0x18,0x20,0x1c,0x20,0x18,0x20,0x15,0x40,0x30,0xc0,0xff,0x40,0x00; /爱情转移*/uchar code sound3=0xff,0x40,0x10,0x39,0x10,0x30,0x10,0x2b,0x10,0x26,0x20,0x20,0x10,0x20,0x10,0x20,0x30,0x18,0x10,0x19,0x20,0x1c,0x20,0x20,0x20,0x20,0x40,0x1c,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,0x20,0x20,0x24,0x10,0x26,0x10,0x26,0x10,0x2b,0x20,0x30,0x10,0x39,0x20,0x30,0x10,0x30,0x10,0x30,0x20,0x20,0x20,0x24,0x10,0x26,0x10,0x2b,0x10,0x30,0x10,0x33,0x10,0x40,0x10,0x39,0x20,0x39,0xc0,0xff,0x20,0x26,0x10,0x20,0x10,0x1c,0x10,0x20,0x10,0x1c,0x10,0x20,0x10,0x1c,0x10,0x18,0x30,0x19,0x10,0x1c,0x10,0x1c,0x10,0x20,0x10,0x1c,0x20,0x20,0x20,0x1c,0x20,0x1c,0x10,0x18,0x10,0x19,0x20,0x1c,0x10,0x20,0x10,0x1c,0x60,0x26,0x20,0x20,0x20,0x1c,0x10,0x20,0x10,0x1c,0x10,0x20,0x10,0x1c,0x10,0x18,0x30,0x15,0x10,0x18,0x10,0x15,0x10,0x18,0x10,0x18,0x10,0x15,0x30,0x13,0x20,0x13,0x10,0x15,0x10,0x18,0x10,0x15,0x20,0x13,0x10,0x13,0x60,0x15,0x20,0x13,0x20,0x15,0x10,0x18,0x10,0x15,0x10,0x18,0x10,0x15,0x20,0x18,0x10,0x15,0x10,0x15,0x60,0x15,0x20,0x13,0x20,0x15,0x10,0x18,0x10,0x18,0x10,0x18,0x10,0x18,0x20,0x19,0x10,0x1c,0x10,0x1c,0x60,0xff,0x20,0x13,0x20,0x15,0x10,0x18,0x10,0x15,0x10,0x18,0x10,0x15,0x20,0x18,0x10,0x15,0x10,0x15,0x20,0x18,0x20,0x18,0x10,0x10,0x30,0x10,0xc0,0x18,0x20,0x15,0x20,0x13,0x10,0x15,0x10,0x13,0x10,0x15,0x10,0x13,0x10,0x15,0x10,0x13,0x10,0x15,0x10,0x15,0x10,0x10,0x30,0x10,0x20,0x13,0x10,0x10,0x10,0x0e,0x10,0x0e,0x10,0x0e,0x10,0x0e,0x10,0x10,0x20,0x13,0x10,0x15,0x10,0x13,0x60,0x15,0x20,0x13,0x20,0x15,0x20,0x18,0x10,0x1c,0x10,0x1c,0x40,0x18,0x20,0x19,0x10,0x1c,0x10,0x1c,0x40,0xff,0x20,0x0e,0x20,0x10,0x20,0x13,0x20,0x15,0x40,0x18,0x20,0x15,0x20,0xff,0x20,0x26,0x20,0x20,0x20,0x26,0x20,0x15,0x20,0x13,0x40,0x15,0x20,0x18,0x20,0x1c,0xc0,0x30,0x40,0x2b,0x30,0x26,0x10,0x39,0x40,0xff,0x20,0x30,0x10,0x39,0x10,0x33,0x10,0x30,0x10,0x2b,0x20,0x2b,0x20,0x30,0x10,0x2b,0x10,0x26,0x10,0x2b,0x10,0x2b,0x20,0x1c,0x10,0x20,0x10,0x2b,0x10,0x26,0x10,0x26,0x80,0x18,0x10,0x19,0x10,0x1c,0x10,0x1c,0x10,0x19,0x20,0x26,0x20,0xff,0x20,0x26,0x20,0x20,0x20,0x26,0x20,0x15,0x20,0x13,0x40,0x15,0x20,0x18,0x20,0x1c,0xc0,0xff,0x20,0x26,0x20,0x20,0x20,0x26,0x20,0x15,0x20,0x13,0x40,0x15,0x20,0x18,0x20,0x1c,0x40,0x1c,0xc0,0x00;/最后一次的温柔*/uchar code sound4=0xff,0x40,0x30,0x30,0x80,0x30,0x30,0x30,0x80,0x26,0x40,0x2b,0x80,0x30,0x30,0x2b,0x80,0x26,0x30,0x30,0x80,0x30,0x30,0x26,0x80,0x20,0x30,0x1c,0xc0,0x1c,0x80,0x1c,0x30,0x20,0x80,0x26,0x30,0x26,0x80,0x30,0x30,0x2b,0x80,0x30,0x30,0x2b,0x80,0x26,0x30,0x30,0x80,0x39,0x30,0x39,0x80,0x40,0x30,0x30,0xc0,0x30,0x80,0x1c,0x30,0x20,0x80,0x26,0x30,0x26,0x80,0x30,0x30,0x2b,0x80,0x30,0x30,0x2b,0x80,0x1c,0x30,0x20,0x80,0x26,0x30,0x26,0x80,0x20,0x30,0x1c,0xc0,0x1c,0x80,0x18,0x30,0x20,0x80,0x26,0x30,0x26,0x80,0x30,0x30,0x2b,0x80,0x30,0x30,0x2b,0x80,0x26,0x30,0x30,0x80,0x39,0x30,0x39,0x80,0x40,0x30,0x30,0xc0,0x30,0xc0,0x00;/友谊地久天长*/*uchar code sound=0xff,0x20,0x60,0x26,0x20,0x20,0x40,0x20,0x20,0x1c,0x20,0x18,0x40,0x18,0x20,0x1c,0x20,0x20,0x80,0x20,0x60,0x1c,0x20,0x20,0x20,0x1c,0x10,0x20,0x10,0x26,0x20,0x2b,0x20,0x20,0x30,0x1c,0x10,0x20,0x20,0x26,0x20,0x2b,0x80,0xff,0x20,0x20,0x20,0xff,0x20,0x20,0x20,0x1c,0x40,0x20,0x40,0x18,0x30,0x1c,0x10,0x20,0x20,0x26,0x20,0x2b,0x80,0xff,0x20,0x20,0x20,0xff,0x20,0x20,0x20,0x26,0x40,0x2b,0x20,0x30,0x20,0x30,0xc0,0xff,0x40,0x00;/中华民谣*/uchar zdjs=0,jp,p,a;uint dpjs;void del(uchar yj) uc
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025成年人地理区域经济发展考试题目及答案
- 八年级生物上册人教版第五单元第四章细菌和真菌第五节《人类对细菌和真菌的利用》 说课稿
- 5.1 让友谊之树常青 说课稿-2023-2024学年统编版道德与法治七年级上册
- Unit 2More than fun Understanding ideas 第1课时说课稿 -2024-2025学年外研版英语七年级上册
- 2025版产业园区委托开发协议范本下载
- 2025版养老服务行业员工劳动合同
- 2025版水电水利工程环境保护与生态补偿机制实施合同
- 2025年餐饮设备租赁服务合同规范
- 2024秋八年级数学上册 第十一章 三角形11.2 与三角形有关的角 1三角形的内角-三角形的内角和说课稿(新版)新人教版
- 2025年创业投资担保合同范本
- 郑州市第四中学新初一分班(摸底)语文模拟试题(5套带答案)
- 2-第二章-各向异性材料的应力-应变关系
- 医院防爆反恐应急预案
- 云南省安全员C证考试题库及答案
- 死亡待遇申请表
- 集中供热管网系统一次网的调节方法
- 无线充电技术在汽车上的应用
- 马工程《刑法学(下册)》教学课件 第17章 危害国家安全罪
- 11科室临床路径、单病种管理目录
- 《廉洁从业》企业文化培训课件
- 综合性文稿写作名师优质课赛课一等奖市公开课获奖课件
评论
0/150
提交评论