基于单片机的音乐盒的设计学院名称:专业:班级:学号:姓名:指导教师姓名:指导教师职称:二〇一四年六月本科毕业设计(论文)江苏理工学院毕业设计说明书(论文)I基于单片机的音乐盒的设计摘要:本次设计根据单片机技术原理,通过硬件电路制作以及软件编程,制作出一个基于AT89C52单片机的简易音乐播放器,该系统以单片机作为电路的主控核心,硬件电路主要由按键电路、复位电路、显示电路等模块组成。系统软件采用C语言进行编写,采用了模块化编程,其移植性较好。系统程序主要包括主程序、播放子程序、按键子程序、延时子程序等。该系统有歌曲播放、电子琴两种模式,可通过按键进行模式选择。本论文包括系统方案的建立、硬件电路的具体设计及软件的程序实现等过程。并通过软硬件的联合调试,验证了设计方案的可行性。该系统最终实现了模式的选择、歌曲的选择及播放等功能,实验证明,该系统具有一定的实用性。关键词:AT89C52单片机;软件编程;音乐盒江苏理工学院毕业设计说明书(论文)IITheDesignofMusicBoxoftheSingleChipMicrocomputerAbstract:Thisdesignaccordingtoprincipleofsinglechipmicrocomputertechnology,throughthehardwarecircuitsandsoftwareprogramming,makeasimplemusicplayerbasedonAT89C52singlechipmicrocomputer,thesystemwithsinglechipmicrocomputerascontrolcoreofthecircuit,thehardwarecircuitismainlycomposedofkeypadcircuit,resetcircuit,displaycircuitmodule.SystemsoftwareusingClanguagetowrite,usingthemodularprogramming.theportablilityisgood.Systemprogrammainlyincludesthemainprogramsubroutine,playedsubroutines,buttons,delaysubroutine.Thesystemhasasongplay,keyboardtwomodes,canthroughthebuttontochoose.Thispaperincludestheestablishmentofthesystem,detaileddesignofhardwarecircuitandsoftwareprogramimplementationprocess.Andthroughthesoftwareandhardwarejointdebugging,verifythefeasibilityofdesignscheme.Thesystemfinallyrealizethepatternselection,selectionofsongsandplayfunction,suchasexperimentsshowthatthesystemhasacertainpracticality.Keywords:AT89C52microcontroller,;Softwareprogramming;themusicbox江苏理工学院毕业设计说明书(论文)目录第1章绪论····························································································11.1课题背景及研究意义···············································································11.2课题设计目的及主要工作·········································································2第2章课题任务分析与方案选择····························································32.1课题任务分析························································································32.2硬件电路的组成·····················································································32.3设计功能要求························································································32.4总体设计原理························································································42.5总体设计框图························································································42.6选用的方案···························································································5第3章系统硬件设计··············································································63.1单片机最小系统·····················································································63.1.1AT89C52单片机介绍················································································63.2.2复位电路介绍························································································83.2.3晶振电路介绍························································································93.3显示电路·····························································································103.44*4矩阵键盘识别电路·············································································113.5声音电路·····························································································12第4章软件设计····················································································144.1Proteus仿真软件与Keil编译介绍····························································144.2音调与节拍··························································································154.2.1发声原理····························································································154.2.2音调的确定·························································································16江苏理工学院毕业设计说明书(论文)4.2.3节拍的确定·························································································174.2.4音乐编码····························································································184.3系统软件总体设计流程图········································································184.3.1主程序流程图·······················································································184.3.2歌曲播放流程图····················································································204.3.3按键扫描流程图····················································································204.3.4延时子程序流程图·················································································21第5章总结···························································································23致谢········································································································24江苏理工学院毕业设计说明书(论文)参考文献································································································25附录1:电路原理图················································································27附录2:元器件清单················································································28附录3:源程序·······················································································29江苏理工学院毕业设计说明书(论文)第1页共54页第1章绪论1.1