毕业设计论文任务书专业班 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
易探云怎么样?易探云是目前国内少数优质的香港云服务器服务商家,目前推出多个香港机房的香港云服务器,有新界、九龙、沙田、葵湾等机房,还提供CN2、BGP及CN2三网直连香港云服务器。近年来,许多企业外贸出海会选择香港云服务器来部署自己的外贸网站,使得越来越多的用户会选择易探云作为网站服务提供平台。今天,云服务器网(yuntue.com)小编来谈谈易探云和易探云服务器怎么样?具体香港云服务器多少钱1个...
有在六月份的时候也有分享过新网域名注册商发布的域名促销活动(这里)。这不在九月份发布秋季域名促销活动,有提供年付16元的.COM域名,同时还有5个+的特殊后缀的域名是免费的。对于新网服务商是曾经非常老牌的域名注册商,早年也是有在他们家注册域名的。我们可以看到,如果有针对新用户的可以领到16元的.COM域名。包括还有首年免费的.XYZ、.SHOP、Space等等后缀的域名。除了.COM域名之外的其他...
DogYun是一家2019年成立的国人主机商,提供VPS和独立服务器租用等,数据中心包括中国香港、美国洛杉矶、日本、韩国、德国、荷兰等,其中VPS包括常规VPS(经典云)和按小时计费VPS(动态云),使用自行开发的面板和管理系统,支持自定义配置,动态云各个硬件独立按小时计费,带宽按照用户使用量计费(不使用不计费)或者购买流量包,线路也可以自行切换。目前商家发布了6.18促销方案,新购动态云7折,经...