简易电子琴的设计

题 目: 简易电子琴的设计 系 部: 班 级: 学 号: 姓 名: 指导老师: 时 间: 摘 要

本论文要设计的为基于单片机的简易电子琴,基本要求为能够发出1、2、3、4、5、6、7等七个音符即可。

众所周知,由于一首音乐是由许多不同的音阶组合而成的,而每个音阶则对应着不同的频率,因此我们可以利用不同的频率来进行音阶的组合,即可产生美妙的音乐了。

对于单片机来说,产生不同的频率非常方便,只要算出某一音频的周期,然后将此周期除以2,即为半周期的时间,利用定时器计时这个半周期时间,每当计时到后,就将输出脉冲的I/O反相,然后重复计时,此半周期再对I/O反相,即可在I/O脚上得到此频率的脉冲。因此我们可以利用单片机的定时器,使其工作在计数器模式MODE1下,改变计数值TH0及TL0来产生不同频率的信号。从而产生不同的音符[1]。

关键词:音阶,频率,单片机 Abstract

This thesis designed for simple keyboard, the basic requirement is to send 1, 2, 3, 4, 5, 6, 7 seven notes.

Well-known, the music is made up by many different scales, and each scale corresponds to different frequency, so we can use different frequency to make combination of scales, and then produce wonderful music.

As for single-chip microcomputer, it is very convenient to produce different frequency, we just calculate an audio cycle, then this cycle divided by 2, namely half cycle time, using timer to time the half cycle time.

Whenever timing, it will output pulse I/O reverse phase, and repeat the timing, the half cycle again to the I/O reversed-phase, then can get this frequency pulse from the I/O feet. So we can use microcontroller timer to make it work in the counter mode and generate different frequency signal. Thus produce different notes.

Keywords: scales,frequency, single-chip microcomputer 目 录

1 绪 论

..................................................................... 1

1.1 论文特点及研究意义

.................................................. 1

1.2 系统简介

............................................................ 1

2 元器件

.................................................................... 1

2.1 元器件的种类

........................................................ 1

2.2 AT89C51

............................................................. 1

2.3 LM386

............................................................... 3

3 硬件电路

.................................................................. 4

3.1 硬件电路图

.......................................................... 4

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4