简易电子琴设计 - 图文 下载本文

内容发布更新时间 : 2024/12/23 9:08:13星期一 下面是文章的全部内容请认真阅读。

新疆农业大学科学

课程名称:

学生姓名: 完成时间: 技术学院

课 程 设 计 报 告

单片机原理与应用

梁保军

2015年7月2日

I

系(部) 课程实训题目 姓 名 同组实训者 指导教师 指 导 教 师 评 语 机电工程系 专业班级 简易电子琴设计 农电122班 梁保军 梁保军 杨涛 吴毅 组 别 实训时间 2015.6.15至2015.7.2

指导教师签名: ______年 ____ 月____日

实训 成绩

II

摘 要

本次设计为简易电子琴设计,利用8051单片机内定时器和I|O端口,设计一台简易电子琴,能通过按键进行简单的乐曲演奏。每个不同的音符对应着不同的频率,利用单片机内部定时器TO结合I|O端口来产生不同频率的方波信号改变TO的计数值即可改变不同的音符。

关键词:8501单片机 音符 频率 内部定时器

III

目 录

一、概 述 ··················································································································· 1

1.1 课题设计目的及其意义 ······················································································ 1 1.2 课题设计的任务与主要内容 ················································································ 1 二、基本组成和原理 ····································································································· 1

2.1 音乐相关知识 ·································································································· 1 2.2 简易电子琴基本原理及其框图 ··········································································· 3

2.2.1基本思想 ································································································ 3 2.2.2硬件框图 ································································································ 3 2.2.3软件设计流程图 ······················································································· 4

····················································································· 4 3.1 元器件清单及其电路图 ·

3.2 单片机89C51的简介 ························································································· 5 3.3 键盘电路 ········································································································ 6 3.4 振荡电路 ········································································································ 7 3.5 复位电路 ········································································································ 7 3.6 音频放大电路 ·································································································· 8 ·································································································· 9 四、 系统软件的设计 ·

··························································································· 9 4.1 系统的软件主程序 ·

·················································································· 12 4.2 系统的软件的调试仿真 ·

总结 ······················································································································· 13 参考文献 ················································································································· 14 附录 ······················································································································· 15

附录1简易电子琴PCB二维图 ··············································································· 15 附录2简易电子琴PCB三维图 ··············································································· 15

IV

基于单片机简易电子琴

一、概 述

1.1 课题设计目的及其意义

单片机(单片微型计算机)是大规模集成电路技术发展的产物,具有高性能、高速度、体积小、价格低廉、稳定可靠等特点。单片机的应用相当广泛,从平常的家用电器到航空航天系统和国防军事、尖端武器都能找到它的身影。因此,单片机的开发应用已成为高科技和工程领域的一项重大课题。

随着社会的发展进步,人们的生活水平也逐步提高,音乐已经成为了我们生活中很重要的一部分,在工作和学习之余,欣赏音乐不仅使身心得到放松,同时也提高人们的精神品质和个人素养。当代,爱好音乐的年轻人越来越多,也有不少人自己练习弹奏乐器,作为业余爱好和一种放松的手段,鉴于一些乐器学习难度大需花费太多精力,且其价格太过于高昂,使得一部分有这种想法的人不得不放弃这种想法,而电子琴又是一种新型的键盘乐器,它是现代电子科技与音乐结合的产物,价格相对便宜,能够满足一般爱好者的需求,因此,在现代音乐中扮演着重要的角色。 故简易电子琴的研制具有一定的社会意义。

1.2 课题设计的任务与主要内容

本文的主要内容是用AT89C51单片机为核心控制元件,设计一个简单的电子琴。以单片机作为主控核心,与键盘、扬声器等模块组成核心主控制模块,在主控模块上设有16个按键和扬声器。定时器按设置的定时参数产生中断,由于定时参数不同,就会发出不同频率的脉冲,不同频率的脉冲经喇叭驱动电路放大滤波后,就会发出不同音调。

先根据要求设计硬件电路和编写相应的程序,然后进行仿真调试,最后细心焊接硬件电路图,将程序烤入芯片中,最终达到设计目的。本系统运行稳定,其优点是硬件电路简单,软件功能完善,控制系统可靠,性价比较高等,具有一定的实用和参考价值。

具体实现的功能:按下音符键可以发出相应的音符。

二、基本组成和原理 2.1 音乐相关知识

在人类还没有产生语言时,就已经知道利用声音的高低、强弱等来表达自己的思想和感情。声带、琴弦等物体振动时会发出声波,声波通过空气传播进入人耳,人们就听到了声音。声音有噪音和乐音之分振动有规律的声音是乐音,音乐中所用的声音主要是乐音。