基于单片机的音乐发生器设计

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

郑州航空工业管理学院

毕业论文(设计)

2013 届电气工程及其自动化专业 1106971 班级

题目基于51单片机的音乐发生器设计

姓名学号

指导教师职称

二О一三年五月十六日

内容提要

本文是应用MCS-51单片机原理和控制理论技术设计音乐发生器的硬件电路,并利用C语言进行软件开发和程序设计。通过控制单片机内部的定时器产生不同频率的方波,驱动喇叭发出不同音调的音乐,再利用延迟控制发音时间的长短。把乐谱转化成相应的定时常数,从而达到从发音设备中演奏出悦耳动听的音乐的效果。

该音乐盒主要由按键电路、复位电路、时钟电路以及蜂鸣器组成。使用两个按键控制音乐盒,一个用来切换歌曲,另一个用来切换8路LED的变化花样,本音乐盒共有两首歌曲,花样灯花样共计3种。播放歌曲时,蜂鸣器发出某个音调,与之对应的LED亮起。本设计利用KEIL编程软件对音乐盒源程序进行编程并调试,配合PROTEUS仿真软件对硬件进行仿真调试,节约了设计时间。

本系统采用C语言进行软件设计。正文中首先简单描述系统硬件工作原理,且附以系统硬件设计框图,论述了本次毕业设计所应用的各硬件接口技术和各个接口模块的功能及工作过程。其次阐述了程序的流程和实现过程。本文撰写的主导思想是软、硬件相结合,以硬件为基础,来进行各功能模块的编写。

关键词

单片机;音乐;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 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 composed 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 sounded 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

working process of the graduation design and the application of the hardware interface technology and the interface module. Secondly, expound the procedures and processes to achieve process. The main idea of this writing is a combination of software and hardware, on the base of hardware, write to each function module.

Key words

Singlechip; music; C language; STC89C51; KEIL; PROTEUS

目录

前言.................... 错误!未定义书签。茕桢广鳓鯡选块网羈泪。

1 概述...................................... 3鹅娅尽損鹌惨歷茏鴛賴。

1.1 课题意义............................. 3籟丛妈羥为贍偾蛏练淨。

1.2 国内外研究的现状及发展趋势........... 3預頌圣鉉儐歲龈讶骅籴。

1.3 音乐发生器的扩展..................... 4渗釤呛俨匀谔鱉调硯錦。

1.3.1设计方案......................... 4铙誅卧泻噦圣骋贶頂廡。

2 51单片机介绍 ............................. 4擁締凤袜备訊顎轮烂蔷。

2.1 Intel 51系列单片机 .................. 4贓熱俣阃歲匱阊邺镓騷。

2.1.1 MCS-51单片机简述............... 5坛摶乡囂忏蒌鍥铃氈淚。

2.1.2 8051与80C51的区别............. 5蜡變黲癟報伥铉锚鈰赘。

2.1.3 8051单片机的引脚功能............ 6買鲷鴯譖昙膚遙闫撷凄。

2.2 51单片机内部结构 .................... 8綾镝鯛駕櫬鹕踪韦辚糴。

2.3 51系列的特性 ........................ 8驅踬髏彦浃绥譎饴憂锦。

2.4 并行I/O口........................... 9猫虿驢绘燈鮒诛髅貺庑。

2.4.1 P0端口的结构及工作原理.......... 9锹籁饗迳琐筆襖鸥娅薔。

2.4.2 P1端口的结构及工作原理......... 11構氽頑黉碩饨荠龈话骛。

2.4.3 P2端口的结构及工作原理......... 11輒峄陽檉簖疖網儂號泶。

2.4.4 P3端口的结构及工作原理......... 12尧侧閆繭絳闕绚勵蜆贅。

2.5 驱动能力............................ 13识饒鎂錕缢灩筧嚌俨淒。

相关文档
最新文档