毕业设计基于单片机的吉他调音器设计.doc

上传人:仙人指路1688 文档编号:2915991 上传时间:2023-03-03 格式:DOC 页数:17 大小:265KB
返回 下载 相关 举报
毕业设计基于单片机的吉他调音器设计.doc_第1页
第1页 / 共17页
毕业设计基于单片机的吉他调音器设计.doc_第2页
第2页 / 共17页
毕业设计基于单片机的吉他调音器设计.doc_第3页
第3页 / 共17页
毕业设计基于单片机的吉他调音器设计.doc_第4页
第4页 / 共17页
毕业设计基于单片机的吉他调音器设计.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《毕业设计基于单片机的吉他调音器设计.doc》由会员分享,可在线阅读,更多相关《毕业设计基于单片机的吉他调音器设计.doc(17页珍藏版)》请在三一办公上搜索。

1、自主创新实践报告设 计 题 目 单片机吉他调音器 学 生 姓 名 史克槽 专 业 机电一体化技术 班 级 机电0901 指 导 教 师 王 泰 日 期 2011-11-24 目录1. 单片机概述.22.创新目标. 33.创新实践任务和要求.44.硬件设计电路.55.软件设计.75.1播放原理.75.2音调和节拍编码.75.3 编程.85.4程序.95.5 Keil uV2仿真.126.样机.137.总结.131.单片机概述 51单片机是对目前所有兼容Intel 8031指令系统的单片机的统称。该系列单片机的始祖是Intel的8031单片机,后来随着Flash rom技术的发展,8031单片机取

2、得了长足的进展,成为目前应用最广泛的8位单片机之一,其代表型号是ATMEL公司的AT89系列,它广泛应用于工业测控系统之中。目前很多公司都有51系列的兼容机型推出,在目前乃至今后很长的一段时间内将占有大量市场。51单片机是基础入门的一个单片机,还是应用最广泛的一种。需要注意的是52系列的单片机一般不具备自编程能力。 当前常用的51系列单片机主要产品有: *Intel的:80C31、80C51、87C51,80C32、80C52、87C52等; *ATMEL的:89C51、89C52、89C2051等; *Philips、华邦、Dallas、Siemens(Infineon) 单片机,由cpu,

3、片内rom(只读存储器相当于电脑硬盘用于存放编程好的数据,一些较老的芯片不带片内rom)ram(动态存储器,相当于电脑内存,用于存放一些临时数据,负责在rom与cpu之间相互沟通),片内定时(计数器),波特率发生器(用于在单片机与电脑,单片机于单片机等外设之间传递数据)等组成,广泛用于家电,机电等电器的控制部分,他相当于一部微型电脑,常见的型号有51内核的80c51,89c51,89s51,89c52,以及一些国产的像89e516等,avr(性能优于51单片机,很多带有A/D转换等较高级的片内外设)的ATtiny13A,ATtiny48,AT90CAN128等,单片机的工作过程编程人员将编好的

4、程序写入单片机rom内,单片机上电后cpu会逐一执行rom内写好的程序,然后按照程序指令驱动相关电路进行工作。单片机编程通常使用c语言或汇编语言进行编程。主要功能 8位CPU4kbytes 程序存储器(ROM) (52为8K) 256bytes的数据存储器(RAM) (52有384bytes的RAM) 32条I/O口线111条指令,大部分为单字节指令 21个专用寄存器 2个可编程定时/计数器5个中断源,2个优先级(52有6个) 一个全双工串行通信口 外部数据存储器寻址空间为64kB 外部程序存储器寻址空间为64kB 逻辑操作位寻址功能双列直插40PinDIP封装 单一+5V电源供电 CPU:由

5、运算和控制逻辑组成,同时还包括中断系统和部分外部特殊功能寄存器; RAM:用以存放可以读写的数据,如运算的中间结果、最终结果以及欲显示的数据; ROM:用以存放程序、一些原始数据和表格; I/O口:四个8位并行I/O口,既可用作输入,也可用作输出; T/C:两个定时/记数器,既可以工作在定时模式,也可以工作在记数模式; 五个中断源的中断控制系统; 片内振荡器和时钟产生电路,石英晶体和微调电容需要外接。最高振荡频率为12M。2.创新目标利用AT89C51单片机制作一个音乐播放器播放一首音乐。希望通过这次的创新实践,一方面可以加深我对单片机的了解,提升自己的专业知识和技能。另一方面可以开发自己的思

6、维,提高自身的创新能力。3.创新实践任务和要求播放音乐最简单的方法就是采用专用音乐芯片,该方法的缺点是音乐芯片只能一次性烧录,播放的内容不可变。而采用单片机播放音乐则能克服这一缺点,其播放的内容以及歌曲的数量都可以随时修改。同时,使用软件Proteus在产品开发的初期对设计进行仿真无疑是一种提高效率和降低成本的好办法,但是仿真毕竟有一定的局限性,要实践起来可能会碰到一些问题。为此,本文通过Proteus软件对用AT89S52单片机播放音乐进行了仿真,指出了实际制作过程中需要注意的地方。4.硬件电路设计1) 仿真软件Proteus简介 Proteus的ISIS是一款Labcenter出品的电路分

7、析实物仿真系统,可仿真各种电路和IC,它支持单片机且元件库齐全,使用方便,是不可多得的专业单片机软件仿真系统。目前可支持的单片机类型有68000系列、8051系列、AVR系列、PIC12系列、PIC16系列、PIC18系列、Z80系列、HC11系列以及各种外围芯片。 2)电路设计 图4.1所示是单片机音乐播放器的仿真原理图。在Proteus仿真软件中,蜂鸣器即可播放音乐。图4.1为单片机音乐播放器原理图a)晶振电路电容大小没有固定值.一般二三十p.晶振是给单片机提供工作信号脉冲的.这个脉冲就是单片机的工作速度.比如 12M晶振.单片机工作速度就是每秒 12M.和电脑的 CPU概念一样.当然.单

8、片机的工作频率是有范围的.不能太大.一般 24M就不上往了.不然不稳定.接地的话数字电路弄的来乱一点也无所谓.看板子上有没有模拟电路.接地方式也是不固定的.一般串联式接地.从小信号到大信号依次接.然后小信号连到电源处.有变压器就连到变压器旁.数模地分开.分别拉到电源处.不可形成回路.这个是由于晶振与单片机的脚XTAL0和脚XTAL1构成的振荡电路中会产生偕波(也就是不希看存在的其他频率的波),这个波对电路的影响不大,但会降低电路的时钟振荡器的稳定性.图4.2所示是单片机晶振电路 图4.2 晶振电路b)复位电路在上电或复位过程中,控制CPU的复位状态:这段时间内让CPU保持复位状态,而不是一上电

9、或刚复位完毕就工作,防止CPU发出错误的指令、执行错误操作,也可以提高电磁兼容性能。无论用户使用哪种类型的单片机,总要涉及到单片机复位电路的设计。而单片机复位电路设计的好坏,直接影响到整个系统工作的可靠性。许多用户在设计完单片机系统,并在实验室调试成功后,在现场却出现了“死机”、“程序走飞”等现象,这主要是单片机的复位电路设计不可靠引起的。图4.3所示为单片机复位电路 图4.3 复位电路5.软件设计5.1播放原理 声音的频谱范围通常约为几十到几千赫兹,通过程序控制单片机的IO口可输出不同频率的矩形波。当该矩形波的频率位于声音频谱范围内时,在单片机的IO口接上喇叭就能发出声音。然后利用延时程序控

10、制矩形波的高、低电平持续时间,即改变矩形波的频率,即可产生不同的音调,从而发出不同的声音,再让矩形波输出的长短对应节拍,就可以实现单片机对音乐的演奏。5.2音调和节拍编码 单片机奏乐只需弄清楚两个概念,也就是“音调”和“节拍”。音调表示一个音符唱多高的频率,节拍表示一个音符唱多长的时间。 由于各个音调对应的频率是已知的,因此,播放音乐时,应对乐曲中出现的音调进行编码,并找出单片机播放这些音调所对应的定时初值。表1所列是音调编码与定时器的初值表,其中频率是已知的,编码可以自己设置,而定时初值是怎样得来的呢?下面以“低6”为例进行说明。“低6”的频率f为440 Hz,其对应的周期为:T=1f=14

11、40=272s。单片机上对应蜂鸣器的IO口来回取反的时间应为:t=T2=22722=1136s。单片机奏乐时,其定时器为工作方式1,若以振荡器的十二分频信号为计数脉冲,如果单片机晶振为12MHz,则1s计数一次。所以,对于“低6”,其定时器的初值应该是:216-1136=64400。 对节拍的控制可通过延时程序来实现。表2所列是节拍编码表。若以1拍的时长为400ms为例,12拍的时长为200ms,14拍的时长为100ms。首先,这样,确定一个基本时长的延时程序,比如以100ms为基本延时时间,那么,14拍可以调用一次延时程序,12拍需调用二次延时程序,1拍需调用四次延时程序,依次类推。5.3

12、编程 音调和节拍都进行过编码后,那么,一首乐曲就可以用若干个8位的简码表示。比如“生日快乐歌”的第一个简码是“82H”,由表1可知,其高四位“8”表示音调“中5”,对应的频率是784Hz,对应的定时器初值是64898;另由表2可知,其低四位“2”表示节拍为“24拍”。这样,任意一首乐曲的简码都可以通过乐谱提取软件获得,而得到简码后,就可以编程了。图3所示是单片机播放音乐的程序流程图,本文使用的是定时器0,音调的高低由定时器来控制P36并按一定频率取反实现,节拍的长短由延时程序控制。流程图中的“TABLE”是由表1中的定时初值组成的。开始初始化定时器0取乐曲简码结束码低四位暂存R5高4位为0延时

13、时间到高位送TH0,低位送TL0启动定时器0延时(由R5确定长短)P3.6按设置的频率取反在TABLE中取计数初值结束结束延时时间到流程图5.4程序ORG 00H JMP START ORG 0BH JMP TIM0START: MOV TMOD,#00000001B MOV IE,#10000010BSTART0: MOV 30H,#00NEXT: MOV A,30H MOV DPTR,#TABLE MOVC A,A+DPTR MOV R2,A JZ END0 ANL A,#0FH MOV R5,A MOV A,R2 SWAP A ANL A,#0FH JNZ SING CLR TR0 JM

14、P D1SING: DEC A MOV 22H,A RL A MOV DPTR,#TABLE1 MOVC A,A+DPTR MOV TH0,A MOV 21H,A MOV A,22H RL A INC A MOVC A,A+DPTR MOV TL0,A MOV 20H,A SETB TR0D1: CALL DELAY INC 30H JMP NEXTEND0: CLR TR0 JMP START0TIM0: PUSH ACC PUSH PSW MOV TL0,20H MOV TH0,21H CPL P3.6 POP PSW POP ACC RETI DELAY: MOV R7,#02D2: M

15、OV R4,#187D3: MOV R3,#248 DJNZ R3,$ DJNZ R4,D3 DJNZ R7,D2 DJNZ R5,DELAY RETTABLE1: DW 64021,64103,64260,64400 DW 64524,64580,64684,64777 DW 64820,64898,64968,65030 DW 65058,65110,65157TABLE: ;1 DB 0A2H,0B2H,0D2H,0B2H,0A4H,0B2H,0D2H DB 0B2H,0A2H,82H,72H,88H DB 72H,82H,0A2H,82H,72H,62H,42H,62H DB 38H,

16、38H ;2 DB 0A4H,02H,0B2H,0A4H,84H DB 72H,82H,72H,62H,72H,84H,72H DB 64H,62H,12H,34H,02H,42H DB 38H,38H ;3 DB 44H,02H,32H,44H,64H DB 72H,82H,72H,62H,72H,84H,0A2H DB 72H,74H,82H,0A4H,02H,0B2H DB 0A8H,0A8H ;4 DB 0B2H,0B4H,0A2H,84H,82H,72H DB 62H,72H,82H,0A2H,88H DB 72H,74H,62H,42H,32H,32H,62H DB 78H,78H

17、 ;5 DB 82H,84H,72H,82H,0A2H,84H DB 72H,82H,72H,62H,48H DB 32H,0A2H,82H,0F2H,0A2H,0B2H,82H,72H DB 68H,68H ;6 DB 0B2H,0B2H,0B2H,0A2H,82H,84H,02H DB 72H,74H,62H,42H,32H,42H,62H DB 78H,78H DB 0A2H,0B2H,0A2H,72H,82H,84H,82H ;7 DB 72H,74H,62H,44H,64H DB 0A8H,0A4H,02H,0A2H DB 0A2H,0B1H,0A1H,82H,0A2H,0B4H,0

18、B2H,0C2H DB 0A2H,0B2H,0A2H,82H,78H ;8 DB 84H,72H,62H,44H,02H,62H DB 72H,81H,71H,62H,72H,84H,02H,0A2H DB 0B4H,02H,82H,74H,82H,72H DB 68H,68H DB 00 END待添加的隐藏文字内容35.5 Keil uV2仿真6.样机7.总结AT89C51芯片有多组引脚,可实现多种扩展功能,由于知识,能力,时间,条件所限,我只实现了播放自编歌曲的功能,其实,还可以同时扩展LED点阵屏幕,按键选歌,以及多组灯光亮等功能,换用更高档的芯片后,甚至可以实现MP3的丰富功能。通过这

19、次的自主创新实践,加深了我对单片机的了解,掌握了单片机的仿真软件的应用,成功的应用了单片机的知识制成了一个简易的音乐播放器,这次的自主创新实践使我受益匪浅。Employment tribunals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if: you dont agree with the disciplinary action your employer has taken against you your em

20、ployer dismisses you and you think that you have been dismissed unfairly.For more information about dismissal and unfair dismissal, seeDismissal.You can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. However, if

21、you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. If your application i

22、s received after this time limit, the tribunal will not usually accept i.If you are worried about how the time limits apply to you, take advice from one of the organisations listed underFurther help.Employment tribunals are less formal than some other courts, but it is still a legal process and you

23、will need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed underFurther help.If you are being

24、 represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as adamages-based agreement. In England and Wales, your solicitor cant charge you more than 35% of your compensation if you win the c

25、ase.If you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CAB, including those that give advice

26、by e-mail, click onnearest CAB.For more information about making a claim to an employment tribunal, seeEmployment tribunals.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football Associations 150th anniversary celebrations

27、and will attend Citys Premier League match at Chelsea on Sunday.I am going to be at the match tomorrow and I have asked to meet Yaya Toure, he told BBC Sport.For me its about how he felt and I would like to speak to him first to find out what his experience was.Uefa hasopened disciplinary proceeding

28、s against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees actions.CSKA said they were surprised and disappointed by Toures complaint. In a statement the Russia

29、n side added: We found no racist insults from fans of CSKA.Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day; May be back in the past, to oneself the paranoid weird belief disillusionment, these day

30、s, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉

31、得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。The end of our life, and can meet many things really do?而穷尽我们的一生,又能遇到多少事情是真正地非做不可?During my childhood, think lucky money and new clothes are necessary for New Year, but as the advance of the age, will be more and more found that those things are op

32、tional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isnt really grow up, it seems is not so important; Then in high school, think dont want to give vent to out your inner voic

33、e can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年时,觉得压

34、岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同学录的时候,突然就发现是不是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐露出自己的心声才能为高中生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起他的容颜。Originally, this world, can produce a chemical reaction to an event, in addition to

35、resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice,

36、 finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦

37、,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship;

38、Have declared the end of the encounter that havent start planning. Those years, those days of do, finally, like youth, will end in our life.此刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。Baumgartner the disappointing news: Missi

39、on aborted. r plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere)

40、 where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause)

41、,e can expect a lot of turbulence.The supersonic descent could happen as early as Sunda.The weatheThe balloon will slowly drift to the edge of space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concr

42、ete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jumpWhen he jumps, he is expected to

43、 reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) m

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号