毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc

上传人:仙人指路1688 文档编号:3975214 上传时间:2023-03-30 格式:DOC 页数:18 大小:244KB
返回 下载 相关 举报
毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc_第1页
第1页 / 共18页
毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc_第2页
第2页 / 共18页
毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc_第3页
第3页 / 共18页
毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc_第4页
第4页 / 共18页
毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc》由会员分享,可在线阅读,更多相关《毕业设计基于AT89C51单片机的霓虹灯控制系统设计.doc(18页珍藏版)》请在三一办公上搜索。

1、目 录0. 前言11. 总体方案设计12. 硬件电路的设计22.1 单片机系统22.2 LED概述32.3 外部时钟方式电路42.4 手动复位电路42.5 霓虹灯控制电路53 软件设计53.1中断服务流程53.2霓虹灯控制电路流程64.联合调试65. 课设小结及进一步设想7参考文献8附录I 元件清单9附录II 整体电路图10附录III 源程序清单11基于AT89C51单片机的霓虹灯控制系统设计摘要:本文主要设计一个基于单片机的霓虹灯控制系统。以AT89C51单片机为控制核心电路,应用片内定时器实现对霓虹灯的控制。该系统由单片机的控制部分和显示部分组成,运用中断定时器控制发光二极管(或LED),

2、使其产生有规律的闪烁和移动。关键字:单片机;发光二极管;定时中断0. 前言随着时代的进步,人们对物质生活的迫切追求,使周边环境发生翻天覆地的变化。从钻木取火走到今天灯火阑珊,各种繁华夜景层出不穷,让人叹为观止。这些辉煌景象都离不开电子技术。事实证明电子技术对社会的发展产生了深远的影响。随着电子技术和计算机技术的发展,特别是单片机的发展,使传统的测量仪器在原理、功能、精度及自动化水平等方面发生了巨大的变化,形成了一种完全突破传统概念的新一代测试仪器智能仪器。智能仪器是以微处理器为核心的电子仪器,它不仅要求设计者熟悉电子仪器的工作原理,而且还要求其掌握微型计算机硬件和软件的原理。目前,有很多的传统

3、电子仪器已有相应的替代产品,而且还出现不少全新的仪器类型和测试系统体系。在科学技术高速发展的今天,如何用简单便宜、性能良好的元器件制造出对人类生活有用的产品,已经成为人们研究的主要趋势。在自动化技术中,无论是过程控制技术还是数据采集技术还是测控技术,都离不开单片机,在工业自动化的领域中,机电一体化技术发挥越来越重要的作用。 1. 总体方案设计在本次设计中,硬件部分由单片机系统、LED发光二极管组成。原理图如图1所示。单片机选用的是AT89C51单片机,利用其中的一个定时器设定灯光闪烁的时间,时钟电路选用的是11.0592M的晶振。复位电路部分采用的是上电复位和手动复位两种复位方式。由于考虑到单

4、片机I/O端口的带载能力,LED发光二极管采用共阳极的接法,用470的电阻分压。 软件部分,由于采用的是11.0592M晶振的时钟电路,单片机定时器的最大定时时间为65.536ms,不能达到要求的闪烁频率。所以采用定时50ms,10个定时中断灯光进行一次亮灭的跳变。并在每一次跳变时记录下灯闪烁的次数,通过对闪烁次数的判断,来进行对不同LED灯的亮灭的整体时序循环控制。单片机LED显示电路复位电路时钟电路 图1 单片机的霓虹灯控制电路原理图2. 硬件电路的设计2.1 单片机系统标准型89系列单片机是与MCS-51系列单片机兼容的。在内部含有4KB或8KB可重复编程的Flash存储器,可进行100

5、0次擦写操作。全静态工作为033MHz,有3级程序存储器加密锁定,内含有128256字节的RAM、32条可编程的I/O端口、23个16位定时器/计数器,68级中断,此外有通用串行接口、低电压空闲模式及掉电模式。AT89C51相当于将8051中的4KB ROM换成相应数量的Flash存储器,其余结构、供电电压、引脚数量及封装均相同,使用时可直接替换。AT89C51在内部采用40条引脚的双列直插式封装,引脚排列如图2所示,内部结构原理图如图3所示。图2 AT89C51芯片引脚I/O存储器EPROM/ROM定时/计数器运算器控制器中断CPU片内振荡器RAM/SFP并行口存储器扩展控制器串行口XTAL

6、图3 AT89C51内部结构原理图本设计中AT89C51使用11.0592MHz晶振。XTAL1(19脚)和XTAL2(18脚):外接晶体引脚,XTAL1和XTAL2分别接外部晶振一端。RST:即为RESET,该引脚为单片机的上电复位或掉电保护端。在此设计中接正常模式按扭。P1.0、P1.1、P1.2:用来控制LED显示器的显示控制。2.2 LED概述 LED(Light Emitting Diode),发光二极管,是一种固态的半导体器件,它可以直接把电转化为光。LED的心脏是一个半导体的晶片,晶片的一端附在一个支架上,一端是负极,另一端连接电源的正极,使整个晶片被环氧树脂封装起来。半导体晶片

7、由三部分组成,一部分是P型半导体,在它里面空穴占主导地位,另一端是N型半导体,在这边主要是电子,中间通常是1至5个周期的量子阱。当电流通过导线作用于这个晶片的时候,电子和空穴就会被推向量子阱,在量子阱内电子跟空穴复合,然后就会以光子的形式发出能量,这就是LED发光的原理。而光的波长也就是光的颜色,是由形成P-N结的材料决定的。它是一种通过控制半导体发光二极管的显示方式,用来显示文字、图形、图像、动画、行情、视频、录像信号等各种信息的显示屏幕。由于具有容易控制、低压直流驱动、组合后色彩表现丰富、使用寿命长等优点,广泛应用于城市各工程中、大屏幕显示系统。LED可以作为显示屏,在计算机控制下,显示色

8、彩变化万千的视频和图片。 LED是一种能够将电能转化为可见光的半导体。近十几年来,为了开发蓝色高亮度发光二极管,世界各地相关研究的人员无不全力投入。而商业化的产品如蓝光及绿光发光二级管LED及激光二级管LD的应用无不说明了IIIV族元素所蕴藏的潜能。在目前商品化LED之材料及其外延技术中,红色及绿色发光二极管之外延技术大多为液相外延成长法为主,而黄色、橙色发光二极管目前仍以气相外延成长法成长磷砷化镓GaAsP材料为主。LED的具体结构如图4所示: 图4 LED的结构图2.3 外部时钟方式电路 外部时钟电路如图5所示,它在单片机的外部通过XTAL1、XTAL2这两个引脚跨接晶体振荡器和微调电容,

9、构成稳定的自激振荡器。本系统采用的为11.0592MHz的晶振,一个机器周期为1us,C1、C2为22PF。 图5 外部时钟方式电路图2.4 手动复位电路复位电路分为上电自动复位和按键手动复位,RST引脚是复位信号的输入端,复位信号是高电平有效。上电自动复位通过电容C3和电阻R2来实现,按键手动复位是图6中复位键来实现的。 图6 手动复位电路2.5 霓虹灯控制电路 霓虹灯控制电路用红色、绿色、黄色LED发光二极管,分别与三个470的分压电阻相串联,分别与单片机的P1.0,P1.1,P1.2口相连,如图7所示: 图7 霓虹灯控制电路 3 软件设计3.1中断服务流程调用中断子程序,设定中断返回地址

10、,中断响应时,执行中断服务程序;手动复位后,返回主程序。中断响应设置中断返回地址中断返回 图8 中断服务程序流程图3.2霓虹灯控制电路流程Red led=flickerRed led=flickerYNTH0,TL0装初值开中断,启动T0开始0n20Red led=flickerYN20n40Green led=flickerYN40n60Yellow led=flickerTMOD初始化 图9 霓虹灯控制电路主程序流程图4.联合调试在protues上进行仿真实验。首先使用Keil uVsion 2将编写完成的程序编译生成HEX文件,将HEX文件烧录到单片机中,进行仿真实验,结果如图10所示,

11、可以看到,LED已经选择性的闪烁。 图10 仿真图5. 课设小结及进一步设想通过这次紧张的课程设计,我收获颇多,每天面对着电脑,翻阅各种相关资料,也亲自动手焊接硬件,体会颇深。在这次课设中,加深了单片机相关知识的理解,也接触了烧录器。在课设开始的前期,也遇到了麻烦,比如说,LED闪烁时间不符合要求,C语言编程不太熟练,很感谢徐涛老师的耐心教导,他的幽默让我们觉得亲切,他的认真负责让我们折服。在繁忙的一个学期即将结束之时,我的思想成熟了,这次的课设让我找到了方向,让我懂得了很多,有知识方面的,但大部分还是人格方面的。我相信,只要不放弃,只要努力,就一定可以!由于时间紧促,自身水平有限,本论文还有

12、许多部分未能详细分析,在此仅作简单了解和认识。参考文献1 赵茂泰.智能仪器原理及应用.北京: 电子工业出版社,2004.72 张毅刚,刘杰.MCS51单片机原理及应用.哈尔滨: 哈尔滨工业大学出版社,2004.63 何立民.单片机应用技术选编.北京: 北京航天航空大学出版,2002.54 张军,梅丽凤.单片机原理接口技术.北京交通大学出版社,2006.55 张婧武,周灵彬.单片机系统的PROTEUS设计与仿真.北京: 电工出版社,2007.46 周佩玲,彭虎.微机原理与接口技术.北京: 电子工业出版社,2005.47 李群芳,张士军.单片微型计算机与接口技术.北京: 电子工业出版社,2008.

13、5附录I 元件清单元件名称型号数量单片机AT89C511LEDArk SM470501K3极性电容10uF1电容22pf2电阻4703电阻1K2排线 2按键1晶振11.0592MHz1附录II 整体电路图附录III 源程序清单#include .#define uchar unsigned char#define uint unsigned int sbit RED_LED = P10; /端口定义。sbit GREEN_LED = P11; sbit YELLOW_LED = P12; uint flicker,i,n; void int0()TMOD=0x01;TH0=0x3C;TL0=0

14、xAF;TR0=1;/启动定时器。ET0=1;/开定时器中断。EA=1;/开总中断void main() /主函数。 n=0; i=0; GREEN_LED=1; YELLOW_LED=1; flicker=0; int0();while(1) if(0=n&n20) YELLOW_LED=1;GREEN_LED=1;RED_LED=flicker; if(20=n&n40)RED_LED=1;YELLOW_LED=1;GREEN_LED=flicker; if(40=n&n60)RED_LED=1;GREEN_LED=1;YELLOW_LED=flicker;if(n=59)n=0; voi

15、d Time0() interrupt 1TR0=0;i+;if(i=10)flicker=flicker;i=0;n+;TH0=0x3C;TL0=0xAF;TR0=1; 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

16、 your employer 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. Howe

17、ver, if 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 appli

18、cation is 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

19、and you 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 a

20、re being 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 w

21、in the case.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

22、 advice 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 celeb

23、rations 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 pr

24、oceedings 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 th

25、e Russian 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, t

26、hese days, 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.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海

27、中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。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 thing

28、s are optional; 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 in

29、ner voice 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

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

31、tion to 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 co

32、wardice, 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.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。

33、嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。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 frie

34、ndship; 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 new

35、s: Mission 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 trop

36、osphere) 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 tro

37、popause),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 t

38、he concrete 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 exp

39、ected to 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 st

40、abilization 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) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277

41、 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).cause there

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

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号