毕业设计基于AT89C51单片机的水位控制系统设计.doc

上传人:laozhun 文档编号:4145334 上传时间:2023-04-07 格式:DOC 页数:15 大小:392.50KB
返回 下载 相关 举报
毕业设计基于AT89C51单片机的水位控制系统设计.doc_第1页
第1页 / 共15页
毕业设计基于AT89C51单片机的水位控制系统设计.doc_第2页
第2页 / 共15页
毕业设计基于AT89C51单片机的水位控制系统设计.doc_第3页
第3页 / 共15页
毕业设计基于AT89C51单片机的水位控制系统设计.doc_第4页
第4页 / 共15页
毕业设计基于AT89C51单片机的水位控制系统设计.doc_第5页
第5页 / 共15页
点击查看更多>>
资源描述

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

1、1 引言1.1 设计目的在工农业生产中,常常需要测量液体液位。随着国家工业的迅速发展,液位测量技术被广泛应用到石油、化工、医药、食品等各行各业中。低温液体(液氧、液氮、液氩、液化天然气及液体二氧化碳等)得到广泛的应用,作为贮存低温液体的容器要保证能承受其载荷;在发电厂、炼钢厂中,保持正常的锅炉汽包水位、除氧器水位、汽轮机凝气器水位、高、低压加热器水位等,是设备安全运行的保证,因此一个安全合适的水位系统是很必要的。1.2 设计要求利用单片机设计一个水位控制系统,要求用开关来模拟水位的状态,当设定完水位后,系统根据水位情况控制电磁阀的开启和关断。具体要求如下:1、设计单片机工作系统电路。2、通过键

2、盘设置其预定水位,根据水位不同控制电机的旋转。5、利用Proteus进行仿真。1.3 设计方法本设计是采用AT89C51单片机为核心芯片,及其相关硬件来实现的水体液位控制系统,采用八个键盘来模拟水位, CPU循环检键盘输入状态,并用3位七段LED显示示液位高度,检测液位数据,实施报警安全提示,当水体液位低于用户设定的值时,系统自动打开泵上水,当水位到达设定值时,系统自动打开排水泵。2 设计方法和原理2.1 水塔水位的控制原理单片机水塔水位控制原理如图l所示,图中的虚线表示允许水位变化的上、下限位置。在正常情况下水位应控制在虚线范围之内。为此,在水塔内的不同高度处,安装固定不变的3根金属棒A、B

3、、C。用以反映水位变化的情况。其中,A棒在下限水位B棒在上、下限水位之间,C棒在上限水位(底端靠近水池底部不能过低,要保证有足够大的流水量)。水塔由电机带动水泵供水。单片机控制电机转动,随着供水,水位不断上升当水位上升到上限水位时,由于水的导电作用。使B、C棒均与+5 V连通。因此B、C两端的电压都为+5 V,即为“l”状态,此时应停止电机和水泵工作,不再向水塔注水;随着水量的减少,当水位处于上、下限之间时。B棒和A棒导通而C棒不能与A棒导通,B端为“1”状态。C端为“0”状态。此时电机带动水泵给水塔注水,使水位上升,或是电机不工作,水位不断下降,都应继续维持原有工作状态;当水位处于下限位置以

4、下时,B、C棒均不能与A棒导通,B、C均为“0”状态。此时应启动电机转动,带动水泵给水塔注水,然后重复原来的过程,这就是简单的水位控制原理。图1 水位控制原理2.2 总体设计方案系统的原理是采用8个按钮进行水位检测,在现场的3个不同的位置,由下至上测量水体的液位值。并把这八个液位状态通过模数转换器传到单片机中(在本系统中采用开关的打开与闭合来模拟),在通过3位七段LED显示器显示出液位的八种状态并通过LED灯报警提示。当水位过低(在3水位)时灯就会变亮,当水位较高(在7水位时)等也会变亮,用来让用户察觉。在水位过高和过低时电磁阀都会自动的抽水或排水,其具体的抽水和排水位置可以设定,此系统中采用

5、的是7水位和3水位。3 硬件设计3.1 硬件设计方案系统方案设计液位控制是利用把液位的利用来管进行模拟,再通过AT89C51把输出状态直接接到单片机的I/O接口,单片机经过运算控制,输出数字信号,输出接口接LED进行显示,实现液位的报警和键盘的显示与控制。由下图可观察到水位由键盘控制输入以后,通过AT89C51单片机的运算控制,在通过LED进行显示,通过报警装置进行报警,报警显示之后再通过对阀门的开启实现对水体的液位进行调节控制,阀门的驱动设备是电动机。图2即是液位控制系统。图2 水位控制系统分析3.2 主芯片AT89C51本系统采用AT89C51作为主要芯片,AT89C51是一种带4K字节F

6、LASH存储器的低电压、高性能CMOS 8位微处理器,俗称单片机。单片机的可擦除只读存储器可以反复擦除1000次。该器件采用ATMEL高密度非易失存储器制造技术制造,与工业标准的MCS-51指令集和输出管脚相兼容。由于将多功能8位CPU和闪烁存储器组合在单个芯片中,ATMEL的AT89C51是一种高效微控制器。AT89C51单片机为很多嵌入式系统提供了一种灵活性高且价廉的方案。在本系统设计中采用AT89C51作为主要的芯片,它具有P0、P1、P2、P3四个I/O口,每个口又有8个接口,32个接口可以满足外接电路的需要,更方便的显示系统。本设计中采用了单片机AT89C51的P0、P1、P3口,分

7、别完成了显示和控制以及报警功能的实现。下图为单片机AT89C51的引脚图。图3 AT89C51引脚图3.3 光报警及显示电路 图4所示为系统的光报警及显示电路,三段LED数码管于单片机的P0-P7口相连,同时排阻的把根线也连在单片机的P0口上,作为上拉电阻。图4 光报警及显示电路3.4 键盘连接电路键盘连接电路如图5所示,八个键盘k1-k8分别与单片机的p1口的p1-p7相连,这八个键盘的按下与否用来模拟的是水位的高低,k1键代表水位最低点,k8键代表的是水位最高点,当k1键按下时,指示灯亮,电机正转,开始加水,一直加水至水位7(即7键按下时),电机开始停止转动,并反向转动抽水,水位开始降低,

8、直至到达3水位,灯亮电机开始自动加水,加水水位可以由用户自己设定,本系统中采取的是3水位便开始加水,7水位开始抽水。本系统采用的是独立式键盘结构,每个按键单独占用一根I/O口线,每个按键的工作不会影响其它I/O口线的状态。它软件是采用查询式结构,首先逐位查询每根I/O口线的输入状态,如某一根I/O口线输入为低电平,则可确认该I/O口线所对应的按键已按下,然后,再转向该键的功能处理程序。图5 键盘连接电路3.5 复位电路系统的复位电路如图6所示。复位电路中上端于单片机的复位引脚相连,下面与与EA端相连,要使CPU只访问外部程序存储器(地址为0000HFFFFH),则EA端必须保持低电平(接到GN

9、D端)。然而要注意的是,如果保密位LB1被编程,复位时在内部会锁存EA端的状态。当EA端保持高电平(接Vcc端)时,CPU则执行内部程序存储器中的程序。其复位电路部分用来对系统进行复位操作,末端与单片机的复位相连,按下复位键,当振荡器运行时,在该引脚上出现两个机器周期的高电平将使单片机复位。图6 复位电路3.6 晶振电路晶体振荡电路的两个端口分别连接在单片机的XTAL1和XTAL2上。晶振电路的作用是为本系统提供基本的时钟信号。通常一个系统共用一个晶振,便于各部分保持同步。有些通讯系统的基频和射频使用不同的晶振,而通过电子调整频率的方法保持同步。晶振电路通常与锁相环电路配合使用,以提供系统所需

10、的时钟频率。如果不同子系统需要不同频率的时钟信号,可以用与同一个晶振相连的不同锁相环来提供。图7 晶振电路4 软件设计4.1 程序流程图及其分析水位检测是通过7个按钮进行水位检测的,当水位到检测位置其输出端口就向单片机输出低电平。由上至下的第一个位置为水位上限报警线,即当水位高于此位置时,开水阀控制系统就会自动报警,提醒工作人员注意,加水电磁阀有可能出故障;第二个位置是自动停止加水线,即当水位高于此位置时,控制系统会自动关闭加水电磁阀,停止加水;第三个位置是自动加水线,即当水位低于此位置时,控制系统会自动接通加水电磁阀,开始加水;第四个位置是水位下限报警线,即当水位低于此位置时,控制系统就会自

11、动报警,提醒工作人员。本设计的一个较大的优点是可以设置多个水位,既用户可根据自己需要设定加水时的水位。根据所分析的该系统的具体功能,可以画出该系统的流程图,流程图应该尽量力求简便,而且从中可以较容易的看出设计者的目的,充分的了解所需设计的系统的功能,从而根据流程图编写程序。图8 水位控制流程图5 系统仿真及实际调试5.1 元器件清单7SEG-COM-CAT-GRNLED数码管AT89C1单片机BUTTON按钮CAP电容G2RL-1A-CF-DC5继电器2N6609三极管CAP-ELEC陶瓷电容CRYSTAL31兆晶振LED-RED发光二极管MOTOR电机RES电阻RESPACK-8排阻5.2

12、系统调试及仿真将所有的硬件按照上面所说的方法连接起来,将源程序在keil c中生成.hex文件,放在在proteus中连接好的电路图中,运行,则可得到正确的结果。图9 水位控制系统仿真图6 总结 设计过程中我遇到了很多的困难,因为知识是不连贯的,所以需要准备很多方面的知识去融合,去联系。由于在学习的时候更注重的是书面上的东西,而本次课程设计更多的是锻炼了我的动手动脑能力,让我有机会把课上学习的知识转化为可以在实际生产生活中应用的技术。本次课程设计的系统主要介绍了水体的液位检测控制,介绍了AT89C51单片机和其它一些单片机在液位控制系统中的应用,介绍了它们的引脚和在系统中的电路图,利用LED来

13、进行信号的输出显示,我设计的硬件系统的结构简化,系统精度高,具有良好的人机交互功能,并设有液位报警,有问题立即就能发现。通过自动调节控制液位并实现水体的液位报警。液位控制在设定值上正常运行不需要人工干预,操作人员劳动强度小。通过本次课程设计,我了解到自己的知识应该充分利用在实践上,在实践中把书本上的知识固化成自己的能力。在设计系统的时候也有很多的想法,但是有一些想法被否定了,最终完成设计的时候优先考虑了在课程上学习到的知识,并且和单片机、电子电路的知识结合起来。这次设计之后,我感觉到自己在自动化专业上的学习应该还有很长的路走,自动化是一个很有前途的行业,它涉及了生产生活的多个方面,对人们的影响

14、可想而知,所以,学好自动化专业的知识不仅仅是对自己能力提升和自我价值的实现,更是一件很有意义,可以让自己有所感触,有所收获的事业。参考文献1 王思明. 单片机原理及应用系统设计.科学出版社.2012.2 陈明荧. 8051单片机课程设计实训教材. 清华大学出版社. 2004.3 丁明亮. 单片机原理及应基于Keil c 与Proteus. 北京航空航天大学出版社. 2009-2.4 梅丽凤. 单片机原理及接口技术. 清华大学出版社.2006-8. 附录源程序清单#include #define uchar unsigned char /*以后定义的uchar都认为是unsigned char*

15、/#define uint unsigned int /*以后定义的uint都认为是unsigned int*/sbit MOR=P27; /*电机正极为P2.7口*/sbit MOT=P26; /*电机负极为P2.6口*/sbit LED=P20; /*LED灯为P2.0口*/code uchar tab=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f; /*定义一个码存表*/void delay (uint n)while(n-); /*10ms的延时*/void LED_SHOW() if(P1=0xfe) /*如果K8键按下*/ P0

16、=tab8;/*P0=0x7f*/ LED=0;/*LED为低电平*/ MOR=0;/*电机正极为低电平*/ MOT=1;/*电机负极为高电平*/ if(P1=0xfd)/*如果K7键按下*/ P0=tab7;/*P0=0x07*/ LED=0;/*P2.0为低电平*/ MOR=0;/*电机正极为低电平*/ MOT=1;/*电机负极为高电平*/ if(P1=0xfb) /*如果K6键按下*/ P0=tab6; /*P0=0x7d*/ LED=1; /*P2.0为高电平*/ MOR=1; /*电机正极为高电平*/ MOT=1; /*电机负极为高电平*/ if(P1=0xf7) /*如果K5键按下

17、*/ P0=tab5; /*P0=0x6d*/ LED=1; /*P2.0为高电平*/ MOR=1; /*电机正极为高电平*/ MOT=1; /*电机负极为高电平*/ if(P1=0xef) /*如果K4键按下*/ P0=tab4; /*P0=0x66*/ LED=1; /*P2.0为高电平*/ MOR=1; /*电机正极为高*/ MOT=1; /*电机负极为高*/ if(P1=0xdf)/*如果K3键按下*/ P0=tab3;/*P0=0x4f*/ LED=0;/*P2.0为低*/ MOR=1;/*电机正极为高*/ MOT=0;/*电机负极为低*/ 待添加的隐藏文字内容2 if(P1=0xb

18、f) /*如果K2键按下*/ P0=tab2; /*P0=0x5b*/ LED=0; /*P2.0为低电平*/ MOR=1; /*电机正极为高电平*/ MOT=0; /*电机负极为低电平*/ if(P1=0x7f) /*如果K1键按下*/ P0=tab1; /*P0=0x06*/ LED=0; /*P2.0为低电平*/ MOR=1; /*电机正极为高电平*/ MOT=0; /*电机负极为低电平*/ void main()while(1) LED_SHOW();仿真运行图Employment tribunals sort out disagreements between employers a

19、nd 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 employer dismisses you and you think that you have been dismissed unfairly.For more information about dismissal and unfair dismissal, seeDismis

20、sal.You can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. However, 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

21、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 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 advi

22、ce 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 will need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thi

23、nking 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 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 wi

24、n 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 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

25、 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 by e-mail, click onnearest CAB.For more information about making a claim to an employment tribunal, seeEmployment tribunals.The (lack of) air

26、 up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football Associations 150th anniversary celebrations 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, h

27、e 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 proceedings against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, president of European footballs governing body, has

28、also ordered an immediate investigation into the referees actions.CSKA said they were surprised and disappointed by Toures complaint. In a statement the 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

29、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 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 lif

30、e trajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。The end of our life, and can meet many things really do?而穷尽我们的一生,又能遇到多少事情是真正地非做不可?During

31、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 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 a

32、lumni 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 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 ag

33、ain 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 resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。A persons time, your ideas are always special to clear. Want, want, l

35、ine 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, 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 one

36、self give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。At the moment, the sky is dark, the air is fresh factor afte

37、r 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; 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.此

38、刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。Baumgartner the disappointing news: 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

39、no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) 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 tha

40、n 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),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 o

41、f 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 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

42、 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 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 app

43、roaches 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-squar

44、e-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 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号