"基于AT89C51的数字音乐盒设计与实现"

版权申诉
5星 · 超过95%的资源 4 下载量 2 浏览量 更新于2024-03-28 2 收藏 364KB DOC 举报
The design of a digital music box based on a microcontroller is a project that utilizes the AT89C51 chip and an LCD display as its core components, along with necessary circuits, to create a single-chip electronic digital music box. The project aims to generate square waves of a certain frequency using the I/O port to drive a buzzer, produce different tones, and display information on an LCD screen to play music (at least three songs, each lasting at least 30 seconds). The system includes an English welcome message upon startup, displays the song number (or name) during playback, and allows for song selection, pause, and play functions using function keys. The design incorporates a 4x4 keypad, uses Protel99 for drawing the hardware system diagram, employs assembly language for programming, compiles the code using KEIL C51, loads the generated HEX file into the chip, simulates the system using Proteus software, and verifies that all functions operate normally. The music box design allows users to select different tracks, play and pause songs, and display the song number and playback time on the LCD screen. The keypad in this design utilizes a dynamic scanning method. Each time a row of keys is scanned, a low level signal is sent to that row, the input port status is read, and the presence of a pressed key is determined. If a key is pressed, the display value is selected based on the input port value and sent to the display value register. The key value is then determined, the T0 counter is started, the offset address for the selected music code is found, and the code generates pulses of a certain frequency to drive the buzzer and produce sound. At the same time, the T1 timer is started to calculate the playback time of the music. Keywords: digital music box, AT89C51, LCD display, Proteus software, 4x4 keypad, dynamic scanning, KEIL C51.
2023-02-27 上传
目录 摘 要 I Abstract II 第一章 设计方案的对比 1 第二章 总体方案设计 2 2.1 原理简介 2 2.2 方案设计思想 2 第三章 方案实现 3 3.1、音频脉冲的产生 3 3.2.音乐节拍的生成 4 3.3.建立音乐的步骤 4 第四章 硬件设计 5 4.1 硬件电路 5 4.1.1、AT89C51的工作特性 5 4.2 原理说明 6 4.3 电路各模块说明 6 4.3.1 键盘系统 6 4.3.2 放大电路 7 4.3.3 时钟电路 8 4.3.4 复位电路 8 5.3.5 显示电路 9 第五章 软件设计 10 5.1 主模块的设计 10 第六章 仿真、安装和调试 12 总结 13 致谢 14 参考文献 14 附录 15 附录一:音乐程序 15 附录二:基于单片机的数字音乐盒总电路图 32 摘 要 本设计是基于单片机的数字音乐盒设计,由单片机AT89C51芯片和LCD显示器为核心, 辅以必要的电路,构成的一个单片机电子数字音乐盒。要求利用I/O口产生一定频率的方 波,驱动蜂鸣器,发出不同的音调并采用LCD显示信息,从而演奏乐曲(最少三首乐曲, 每首不少于30秒),开机时有英文欢迎提示字符,播放时显示歌曲序号(或名称),可 通过功能键选择乐曲,暂停,播放。 本设计采用4*4键盘,用Protel99来画系统硬件图,采用汇编语言进行编程,编程后 利用KEIL C51来进行编译,再生成的HEX文件装入芯片中,采用proteus软件来仿真,检验功能得以 正常实现。该音乐盒的设计可以通过按键选择不同的曲目,播放和暂停,并通过LCD显示 歌曲号及播放时间。 本设计键盘采用动态扫描方式。每次扫描一行键盘,送此行低电平,读输入口的状态 值,判断有没有键按下。若有键按下,根据读入口的值选择显示值并送至显示值寄存单 元,判断键值,启动计数器T0,根据次值为偏移地址找到要选择的音乐的代码的首地址 ,根据代码产生一定频率的脉冲,驱动蜂鸣器,放出音。同时启动定时器T1,计算音乐 的播放的时间。 关键词:数字音乐盒 AT89C51 LCD显示器 Proteus软件 4*4键盘 动态扫描 KEIL C5 Abstract The design of digital music box is based on singal-chip microc- omputer.The Chip of AT89C51 and LCD displayer was the heart of this design,with some necessary aided circuits,thus constructing the digital depends on singal-chip microcomputer.This design requires the I/O ports whitch have a certain frequency,square wave,then driving the buzzer to produce different tones,and LCD display information to play music(at least 3 songs,no less than 30 seconds per song),There have Englishwelcome prompt character and song number displayed on LCD when turn on the button.It can complited the music play or pause by select the function key. The design uses 4*4keyboard,with protel99 to draw the systerm hardware chart,assembly language progra-mming,programming for later use keil compiler,and then load the generated HEX filechip,using proteus simulation software,testing fun-ctions can be properly realized,The design of music box plays achived through the buttons to select a different track,pl-ay and pause,and through the LCD display the song number and play time. The dynamic scann