ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:251.69KB ,
资源ID:5445171      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5445171.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(单片机音乐设计.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

单片机音乐设计.docx

1、单片机音乐设计 单片机音乐设计题 目: 龙的传人 作 者: 焦亚琪_ 一、龙的传人的简谱二、龙的传人的硬件结构:三、龙的传人的程序如下:#include AT89X52.H#define F1 10000 /1/4#define F2 20000 /1/2#define F3 40000 /1/1unsigned char t0_high=0x00; /T0高8位unsigned char t0_low=0x00; /T0低8位unsigned char YH21= 0xF7,0xF8,0xF9,0xF9,0xFA,0xFB,0xFB, 0xFB,0xFC,0xFC,0xFC,0xFD,0xF

2、D,0xFD, 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE;unsigned char YL21= 0xD8,0xBC,0x85,0xE5,0x92,0x29,0xB0, 0xEF,0x62,0xC7,0xF5,0x4C,0x97,0xDC, 0xFB,0x34,0x67,0x7D,0xA8,0xCF,0xF1;sbit Q=P27;stop1(void) unsigned int i; TR0=0; for(i=0;i=4700;i+); TR0=1;stop2(void) unsigned int i; TR0=0; for(i=0;i=11400;i+); TR

3、0=1;delay(n) unsigned int i; for(i=0;i=n;i+);void timer0() interrupt 1 /用于产生音符的T0中断服务程序 TH0=t0_high; TL0=t0_low;Q=Q; /取反beep引脚,发声void main(void) TMOD=0X01; /T0方式1 TR0=0; /关闭T0(不发声) TH0=0xFF; TL0=0x00; ET0=1; /允许T0中断 EA=1; /允许总中断 TR0=1; while(1) t0_high=YH13; t0_low=YL13; delay(F3); stop1(); t0_high=

4、YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); stop2(); /第一节 t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH15

5、; t0_low=YL15; delay(F2); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH13; t0_low=YL13; delay(F3+F3+F3); stop1(); stop2(); /第二节 t0_high=YH13; t0_low=YL13; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH

6、16; t0_low=YL16; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); stop2(); /第三节 t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH16;

7、t0_low=YL16; delay(F2); stop1(); t0_high=YH17; t0_low=YL17; delay(F3+F3+F3); stop1(); stop2(); /第四节 t0_high=YH13; t0_low=YL13; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F3); stop1(); t0_high=YH17

8、; t0_low=YL17; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); stop2(); /第五节 t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH13; t0_low=YL13; delay(F3+F3+F3); stop1(); stop2(); /

9、第六节 t0_high=YH14; t0_low=YL14; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); stop2(); /第七节 t0_high=YH13; t0_low=YL13; delay(F3); stop1();

10、t0_high=YH13; t0_low=YL13; delay(F2); stop1(); t0_high=YH12; t0_low=YL12; delay(F2); stop1(); t0_high=YH13; t0_low=YL13; delay(F3+F3+F3); stop1(); stop2(); /第八节 t0_high=YH17; t0_low=YL17; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; delay(F3); stop1()

11、; t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); stop2(); /第九节 t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH17; t0_low=YL17; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F3+F3+F3); stop1

12、(); stop2(); /第十节 t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); stop2(); /第十一节 t0_high=YH14; t0_low=YL14; delay

13、(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); t0_high=YH14; t0_low=YL14; delay(F3+F3+F3); stop1(); stop2(); /第十二节 t0_high=YH17; t0_low=YL17; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; delay(F3); stop1(); t0_high=YH17; t0_low=YL17; de

14、lay(F3); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F2); stop1(); stop2(); /第十三节 t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay(F2); stop1(); t0_high=YH17; t0_low=YL17; delay(F2); stop1(); t0_high=YH16; t0_low=YL16; delay

15、(F3+F3+F3); stop1(); stop2(); /第十四节 t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); t0_high=YH15; t0_low=YL15; delay(F3); stop1(); t0_high=YH14; t0_low=YL14; delay(F2); stop1(); stop2(); /第十五节 t0_high=YH13;

16、t0_low=YL13; delay(F2); stop1(); t0_high=YH13; t0_low=YL13; delay(F2); stop1(); t0_high=YH12; t0_low=YL12; delay(F2); stop1(); t0_high=YH13; t0_low=YL13; delay(F3+F3+F3); stop1(); stop2(); /第十六节 TR0=0; while(1); 四、单片机发声原理1、用单片机产生音频脉冲 音频脉冲激音符发出各种不同的声音,通过计算音频的周期可以得出频率的脉冲。首先算出某一音频的周期(1/频率),将此音频周期除以2,即为半周期的时间,利用定时器计时这半个周期,如到半个周期时间就将输出脉冲的I/O反相。重复此计时操作,每当到半周期时间就输出脉冲的I/O反相,这样就可以得到音频的脉冲。2、用单片机实现音乐的节拍 音符节拍依靠延时程序来实现,各调1/4节拍的延时为多少。3、于蜂鸣器并联的发光二极管会与蜂鸣器同步的亮灭,表明蜂鸣器的工作状态。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1