毕业设计论文任务书专业班 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
快云科技: 11.11钜惠 美国云机2H5G年付148仅有40台,云服务器全场7折,香港云服务器年付388仅不到五折 公司介绍:快云科技是成立于2020年的新进主机商,持有IDC/ICP/ISP等证件资质齐全主营产品有:香港弹性云服务器,美国vps和日本vps,香港物理机,国内高防物理机以及美国日本高防物理机官网地址:www.345idc.com活动截止日期为2021年11月13日此次促销活动提供...
georgedatacenter怎么样?georgedatacenter这次其实是两个促销,一是促销一款特价洛杉矶E3-1220 V5独服,性价比其实最高;另外还促销三款特价vps,大家可以根据自己的需要入手。georgedatacenter是一家成立于2019年的美国vps商家,主营美国洛杉矶、芝加哥、达拉斯、新泽西、西雅图机房的VPS、邮件服务器和托管独立服务器业务。georgedatacen...
10GBIZ服务商经常有看到隔壁的一些博客分享内容,我翻看网站看之前有记录过一篇,只不过由于服务商是2020年新成立的所以分享内容比较谨慎。这不至今已经有将近两年的服务商而且云服务产品也比较丰富,目前有看到10GBIZ服务商有提供香港、美国洛杉矶等多机房的云服务器、独立服务器和站群服务器。其中比较吸引到我们用户的是亚洲节点的包括香港、日本等七星级网络服务。具体我们看看相关的配置和线路产品。第一、香...