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

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

易探云:香港大带宽/大内存物理机服务器550元;20Mbps带宽!三网BGP线路

易探云怎么样?易探云隶属于纯乐电商旗下网络服务品牌,香港NTT Communications合作伙伴,YiTanCloud Limited旗下合作云计算品牌,数十年云计算行业经验。发展至今,我们已凝聚起港内领先的开发和运维团队,积累起4年市场服务经验,提供电话热线/在线咨询/服务单系统等多种沟通渠道,7*24不间断服务,3分钟快速响应。目前,易探云提供香港大带宽20Mbps、16G DDR3内存、...

RAKSmart VPS主机半价活动 支持Windows系统 包含香港、日本机房

RAKSmart 商家最近动作还是比较大的,比如他们也在增加云服务器产品,目前已经包含美国圣何塞和洛杉矶机房,以及这个月有新增的中国香港机房,根据大趋势云服务器算是比较技术流的趋势。传统的VPS主机架构方案在技术层面上稍微落后一些,当然也是可以用的。不清楚是商家出于对于传统VPS主机清理库存,还是多渠道的产品化营销,看到RAKSmart VPS主机提供美国、香港和日本机房的半价促销,当然也包括其他...

pacificrack:$12/年-1G内存/1核/20gSSD/500g流量/1Gbps带宽

pacificrack在最新的7月促销里面增加了2个更加便宜的,一个月付1.5美元,一个年付12美元,带宽都是1Gbps。整个系列都是PR-M,也就是魔方的后台管理。2G内存起步的支持Windows 7、10、Server 2003\2008\2012\2016\2019以及常规版本的Linux!官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款7月秒杀VP...

qq音乐不能播放为你推荐
郭吉军一个新的品牌,要怎么做网络推广绵阳电信绵阳电信宽带资费无线路由器限速设置无线路由器限速怎么设置!开机滚动条电脑开机滚动条要走好几次ios7固件下载iphone自动下载IOS7固件版本怎么删除lockdowndios8.1能用gpp3to2吗?型号A1429机械键盘轴机械键盘的轴哪种好?srv记录exchange 2010 自动发现需不需要srv记录宽带接入服务器用wifi连不上服务器怎么办freebsd安装FreeBSD系统NetBSD系统OpenBSD系统 这三个系统安装方法相似吗?用什么方法装哦?
新网域名解析 便宜服务器 lunarpages 外贸主机 表格样式 免费个人博客 好看的桌面背景图 灵动鬼影 qq数据库下载 怎样建立邮箱 me空间社区 网站卫士 免费申请个人网站 重庆双线服务器托管 in域名 双线asp空间 东莞主机托管 畅行云 腾讯数据库 云服务是什么意思 更多