摘 要:随着单片机技术的飞快发展,基于单片机的系统受到了广泛的应用。本设计是基于51单片机设计的一款简易的电子琴音乐盒,采用4*4矩阵触摸键盘,实现16个音调和3首内置乐曲播放。本设计中利用单片机中断系统和定时/计数原理来控制扬声器发声,用程序语言确定音乐发生所必须的音符和节拍。本设计以STC89C51单片机作为系统的核心控制部分,通过控制单片机的定时器产生一定频率的方波,驱动扬声器,从而播放预存的音乐。通过数码管显示当前音乐播放的音调值,通过按键控制播放、录制、回放音乐和弹奏音乐。然后利用keil编程软件对音乐盒源程序进行编程并调试,并配合Proteus仿真软对硬件进行仿真调试,最后通过电路板的焊接、程序的烧录和调试,制作完成电子琴音乐盒。61273
毕业论文关键词:单片机,电子琴,音乐盒,Proteus
Abstract:With the fast development of chip technology, the microcontroller-based system has been widely used. The design is based on 51 single-chip design of a simple keyboard music box, with 4 * 4 matrix touch keyboard, 16-tones and three built-in music player.In the design of the system,to make the speaker sound used the single-chip interrupt timer / counter principle,the necessary notes and beats of music occurrence determined by the application language. The design has a STC89C51 microcontroller as the core system control section,to produce a certain frequency by controlling the microcontroller timer square wave,to drive the speaker, so as to play stored music.It displays the current pitch value of music palyback through a digital.It controls to playback,record,paly back music and play music by buttons.Then i use keil source programming software for music programming and debugging box, and with Proteus simulation software to hardware simulation debugging, and finally through the circuit board welding, burning and commissioning procedures, produced electronic organ music box.
KEYWORDS: Single Chip Microcomputer, Electronic organ, Music box, Protues
1 绪论 4
1.1 课题研究背景与意义 4
1.2 电子琴音乐盒的发展概况 4
1.3 本文研究的内容与安排 5
2 电子琴音乐盒总体方案设计 5
2.1 系统控制要求 5
2.2 总体方案设计 5
2.3 各个模块的选择 6
3 电子琴音乐盒硬件电路设计 7
3.1 系统总电路原理图设计 7
3.2 单片机最小系统设计 8
3.2 键盘扫描电路 9
3.3 录歌、回放模块电路 10
3.4 扬声器驱动电路 11
3.5 数码管显示模块 11
3.6 LED指示灯电路 12
4 电子琴音乐盒软件设计 13
4.1 主程序流程图 13
4.2 单片机实现节拍 17
4.3 单片机产生音频脉冲 18
5 系统仿真 19
5.1 原理图的绘制 19
5.2 程序的录入