1、 毕 业 论 文(设 计) 2013 届 电气工程及其自动化 专业 1106971 班级 题 目 基于 51 单片机的音乐发生器设计 姓 名 学号 指导教师 职称 二一三年五月十六日 内内 容容 提提 要要 本文是应用 MCS-51 单片机原理和控制理论技术设计音乐发生器 的硬件电路,并利用 C语言进行软件开发和程序设计。通过控制单片 机内部的定时器产生不同频率的方波,驱动喇叭发出不同音调的音 乐, 再利用延迟控制发音时间的长短。 把乐谱转化成相应的定时常数, 从而达到从发音设备中演奏出悦耳动听的音乐的效果。 该音乐盒主要由按键电路、 复位电路、 时钟电路以及蜂鸣器组成。 使用两个按键控制音乐
2、盒,一个用来切换歌曲,另一个用来切换 8路 LED 的变化花样,本音乐盒共有两首歌曲,花样灯花样共计 3种。播 放歌曲时,蜂鸣器发出某个音调,与之对应的 LED 亮起。本设计利用 KEIL 编程软件对音乐盒源程序进行编程并调试,配合 PROTEUS 仿真 软件对硬件进行仿真调试,节约了设计时间。 本系统采用 C 语言进行软件设计。 正文中首先简单描述系统硬件 工作原理,且附以系统硬件设计框图, 论述了本次毕业设计所应用的 各硬件接口技术和各个接口模块的功能及工作过程。 其次阐述了程序 的流程和实现过程。本文撰写的主导思想是软、硬件相结合,以硬件 为基础,来进行各功能模块的编写。 关 键 词 单
3、片机;音乐;C 语言;STC89C51;KEIL;PROTEUS Abstract In this paper, The music generator and its hardware circuit is designed by MCS-51 single-chip microcomputer principle and control theory, and the Software development and programming are based on C language programming. According to control the MCU internal
4、timer to produce different frequency Square wave to drive the horn sounds of different tones of music, then use the delay to control the length of time. The music Transformationed into the timing constants corresponding so that the sound equipment can play Melodious music. The music box is mainly co
5、mposed of keypad circuit, reset circuit, clock circuit and a buzzer. Two buttons are used to control the music box, one to switch songs, another is used to switch the 8 LED pattern, the music box has two songs, a total of 3 kinds of pattern light pattern. While the music is playing, the buzzer sound
6、ed a tone, and the corresponding LED lights up. The design of programming the music box and debug source code using KEIL programming software, and to save the design time the PROTEUS simulation software is used to simulate the hardware debugging. The system uses C language for software design. Firstly, in the text describes the working principle of the system hardware, and attached to the system block diagram of hardware design to discusse the function and wo