单片机课程设计论文 题 目 FSY电子音乐盒的单片机设计 学 院 通信与电子工程学院 专业班级 电子083 学生姓名 指导教师 王发智 2011年12月11日 摘 要 为了实现单片机控制音乐播放,此次毕业设计做出了尝试,即电子音乐盒的设计。本设计采用了蜂鸣器发声来实现歌曲的播放,能保持基本音调不变,流畅播放出歌曲。现选用AT89S51单片机。 主要设计模块包括数码管显示部分,功能键盘部分,蜂鸣器发声部分,彩灯部分。数码管采用共阳极数码管,通过单片机P1口控制,实现歌曲序号的显示;功能键盘采用按键开关,通过单片机P3口控制,实现歌曲播放顺序的调换和暂停播放功能;蜂鸣器由单片机的P2口控制,实现歌曲播放;彩灯是由普通发光二极管代替,能实现单色长亮和闪烁效果。 主要工作过程是通过按下功能键实现上一首和下一首及暂停播放,同时有数码管显示当前播放歌曲的序号,蜂鸣器播放出音乐,当播放最后一首夜曲时还伴有彩灯闪烁。 此次设计要利用单片机及KeilC51编程软件编程和PROTEUS单片机仿真软件和电子电工等方面知识,用KeilC51编程软件编程,用PROTEUS单片机仿真软件仿真。最后制作实物,将程序下载到单片机中,利用I/O口产生一定频率的方波,驱动蜂鸣器,发出不同的音调,从而演奏乐曲。 关键词:AT89S51单片机 方波 音调 Abstract In order to achieve single-chip control music playback,The design made an attempt to,That the design of electronic music box,This design uses a buzzer sound to achieve the song playing, can maintain the same basic tone, smooth playback of songs. AT89S51 microcontroller is used. Major design modules include digital display part, function keyboard parts, some of the buzzer sound, lights parts. Using common anode LED digital tube, through the P1 port control chip to realize the song number display; function keyboard with key switch, controlled by microcontroller port P3, playing songs in order to achieve the exchange and pause functions; buzzer by the microcontroller P2 port control, to achieve the song playing; lights are replaced by the ordinary light-emitting diodes, to achieve long light and color flashing effect. Main work process is achieved by pressing the function key and the next one on the head, and a pause, while a digital display serial number of the currently playing song, buzzer playing the music, when played with the last one Nocturne Shihai lights To take advantage of the chip design and software programming and programming KeilC51 PROTEUS microcontroller simulation s