单片机基于单片机的带音乐播放的电子琴设计

qq音乐不能播放  时间:2021-02-25  阅读:()

毕业设计论文任务书专业班 09电子3班 姓名 陈中乾 学号:课题名称、主要内容和基本要求

进度安排

指导教师评语

评阅教师评语

毕业设计论文成绩

答辩委员会主任签名

1.摘要

电子琴是现代电子科技与音乐结合的产物是一种新型的键盘乐器。它在现代音乐扮演着重要的角色单片机具有强大的控制功能和灵活的编程实现特性它已经溶入现代人们的生活中成为不可替代的一部分。本文的主要内容是用AT89S51单片机为核心控制元件设计一个电子琴。 以单片机作为主控核心与键盘、扬声器等模块组成核心主控制模块在主控模块上设有10个按键和扬声器。本系统运行稳定其优点是硬件电路简单软件功能完善控制系统可靠性价比较高等具有一定的实用和参考价值。

众所周知 由于一首音乐是由许多不同的音阶组合而成的而每个音阶则对应着不同的频率 因此我们可以利用不同的频率来进行音阶的组合 即可产生美妙的音乐了。

对于单片机来说产生不同的频率非常方便只要算出某一音频的周期然后将此周期除以2 即为半周期的时间利用定时器计时这个半周期时间每当计时到后就将输出脉冲的I/O反相然后重复计时此半周期再对I/O反相 即可在I/O脚上得到此频率的脉冲。因此我们可以利用单片机的定时器使其工作在计数器模式MODE1下改变计数值TH0及TL0来产生不同频率的信号。从而产生不同的音符[1] 。

关键词音阶频率单片机

2.Abstract

Electronic organ is a modern electronic music technology and the product is a new type ofkeyboard instruments. It played an important role in modern music.SCM has powerful contro l functions and flexible pro gramming characteristic s. It has converged with modern people's lives,become an irreplaceable part.The main content is AT89S51 control of the core components,design ofa electronic organ.SCM as a host to the core,with the keyboard, speaker and other core modules. In the main control module has 16 keys and a speaker.The system is steady, its simple hardware circuits, software functions,reliability of control system and high cost performance is its advantages.It also has certain practical and reference value.

Well-known, the music is made up by many different scales, and each scalecorresponds to different frequency, so we can use different frequency to makecombination of scales,and thenproduce wonderful music.

As for single-chip microcomputer, it is very convenient to produce differentfrequency,we just calculate an audio cycle, then this cycle divided by 2,namely halfcycle time,using timer to time the half cycle time.

Whenever timing, it will output pulse I/O reverse phase, and repeat the timing,the half cycle again to the I/O reversed-phase, then can get this frequency pulse fromthe I/O feet. So we can use microcontroller timer to make it work in the counter modeand generate different frequency signal.Thus produce different notes.

Keywords: scales,frequency, s ingle-chip microcomputer

目 录

第一章绪论. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

1. 1电子琴的特点及研究意义. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

1.2 系统介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

第二章方案论证. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

2. 1单片机选择. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

2.2键盘选择. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

2.3功放电路选择. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4

第三章系统设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

3. 1单片机的介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

3. 1. 1单片机AT89S52基本知识. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

3. 1.2单片机AT89S52产品特点. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6

3. 1.3单片机AT89S52的使用. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6

3. 1.4单片机AT89S52的特性. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7

3. 1.5 AT89S52引脚功能与封装. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8

3.2 LED数码管. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10

3.2. 1 LED数码管主要技术参数. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10

3.2.2 LED数码管的引脚说明. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11

3.2.3数码管编码说明. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3 LM386. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3. 1LM386简介. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3.2 LM386特性. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3.3 LM386应用特点. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3.4 LM386引脚图. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13

3.3.5 LM386注意事项. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14

第四章硬件设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15

4. 1总体电路设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15

4.2单片机最小系统电路. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16

4.3LM386功放电路. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16

4.4数码管显示电路. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17

4.5按键电路. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18

4.6按键指示灯电路. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19

4.7音乐产生方法. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19

第五章软件设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22

5. 1程序流程图. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22

5.2 S1-S8按键识别程序. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22

5.3 S9键识别电路程序. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24

5.4音乐产生程序. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

第六章调试过程. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29

6. 1数码管显示乱码. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29

6.3按键处理问题. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29

结论. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29

参考文献. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30

谢辞. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31

附录. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32

附录一程序源代码. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32

附录二电路图. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45

gcorelabs:美国GPU服务器,8张RTX2080Ti,2*Silver-4214/256G内存/1T SSD/

gcorelabs提供美国阿什本数据中心的GPU服务器(显卡服务器),默认给8路RTX2080Ti,服务器网卡支持2*10Gbps(ANX),CPU为双路Silver-4214(24核48线程),256G内存,1Gbps独享带宽仅需150欧元、10bps带宽仅需600欧元,不限流量随便跑吧。 官方网站 :https://gcorelabs.com/hosting/dedicated/gpu/ ...

Boomer.host:$4.95/年-512MB/5GB/500GB/德克萨斯州(休斯顿)

部落曾经在去年分享过一次Boomer.host的信息,商家自述始于2018年,提供基于OpenVZ架构的VPS主机,配置不高价格较低。最近,主机商又在LET发了几款特价年付主机促销,最低每年仅4.95美元起,有独立IPv4+IPv6,开设在德克萨斯州休斯顿机房。下面列出几款VPS主机配置信息。CPU:1core内存:512MB硬盘:5G SSD流量:500GB/500Mbps架构:KVMIP/面板...

特网云-新上线香港五区补货资源充足限时抢 虚拟主机6折,低至38元!

官方网站:点击访问特网云官网活动方案:===========================香港云限时购==============================支持Linux和Windows操作系统,配置都是可以自选的,非常的灵活,宽带充足新老客户活动期间新购活动款产品都可以享受续费折扣(只限在活动期间购买活动款产品才可享受续费折扣 优惠码:AADE01),购买折扣与续费折扣不叠加,都是在原价...

qq音乐不能播放为你推荐
yy频道中心yy语音怎么进频道中心在线漏洞检测求免费的漏洞扫描工具怎么在qq空间里添加背景音乐怎样在qq空间里免费添加背景音乐?网站联盟网站联盟的运作流程ios系统ios系统有哪些版本?虚拟专用网虚拟专用网适用于什么行业网络广告投放网络广告投放有哪些技巧?发邮件怎么发发邮件怎么发?freebsd安装FreeBSD下如何安装ports的方法去鼠标加速度win7怎么去鼠标加速度
网站备案域名查询 godaddy域名解析教程 新秒杀 idc评测 edgecast 便宜域名 博客主机 la域名 patcha 免费个人博客 华为4核 中国电信测速112 dux 新天域互联 老左来了 lol台服官网 adroit 美国在线代理服务器 微软服务器操作系统 谷歌台湾 更多