毕业设计基于89S51单片机的测温系统设计_第1页
毕业设计基于89S51单片机的测温系统设计_第2页
毕业设计基于89S51单片机的测温系统设计_第3页
毕业设计基于89S51单片机的测温系统设计_第4页
毕业设计基于89S51单片机的测温系统设计_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、目录摘要1第一章 绪论3第二章 元件简介52.1 ad590温度传感器简介62.2 a/d转换器adc0809简介82.3 at89c51单片机简介131主要特性:132管脚说明:14第三章 系统硬件设计151、温度传感器的选择152、信号放大器图32163、a/d转换器的选择164、at89c51的资源分配16第四章 软件设计181、a/d转换控制182、 温度检测子程序193、 温度显示204、温度超限报警子程序205、延时程序21第五章 附录221、硬件222、软件23第六章 结束语26参考文献:27致 谢27摘要随着时代的进步和发展,单片机技术已经普及到我们生活、工作、科研、各个领域,

2、已经成为一种比较成熟的技术, 本文主要介绍了一个基于89s51单片机的测温系统,详细描述了利用数字温度传感器ds18b20开发测温系统的过程,重点对传感器在单片机下的硬件连接,软件编程以及各模块系统流程进行了详尽分析,对各部分的电路也一一进行了介绍,该系统可以方便的实现实现温度采集和显示,并可根据需要任意设定上下限报警温度,它使用起来相当方便,具有精度高、量程宽、灵敏度高、体积小、功耗低等优点,适合于我们日常生活和工、农业生产中的温度测量,也可以当作温度处理模块嵌入其它系统中,作为其他主系统的辅助扩展。关键字:单片机、温度检测、系统abstract along with the progres

3、s of the times and development, microcontroller technology has spread to our life, work,scientific research, each domain, has become a mature technology, this paper mainly introduces a 89s51 mcu based on temperature measuring system, described in detail by using digital temperature sensor ds18b20 de

4、velopment temperature measuring system, focusing on the process of sensors in the hardware connection, microcontroller software programming and each module in the system flow makes a detailed analysis, part of the circuit also introduces one, the system is easy to realize the realization temperature

5、 gathering and display, and can according to need to set arbitrary upper alarm temperature, it uses up is very convenient, with high precision, range wide, high sensitivity, small volume, low consumption advantages, suitable for our daily life and work, agriculture of temperature measurement, also c

6、an be used as temperature processing modules embedded other systems, as any other main system of auxiliary expansion.第一章 绪论随着科技的不断发展,现代社会对各种信息参数的准确度和精确度的要求都有了几何级的增长,而如何准确而又迅速的获得这些参数就需要受制于现代信息基础的发展水平。在三大信息信息采集(即传感器技术)、信息传输(通信技术)和信息处理(计算机技术)中,传感器属于信息技术的前沿尖端产品,尤其是温度传感器技术,在我国各领域已经引用的非常广泛,可以说是渗透到社会的每一个领域

7、,人民的生活与环境的温度息息相关,在工业生产过程中需要实时测量温度,在农业生产中也离不开温度的测量,因此研究温度的测量方法和装置具有重要的意义。测量温度的关键是温度传感器,目前的智能温度传感器(亦称数字温度传感器)是在20世纪90年代中期问世的,它是微电子技术、计算机技术和自动测试技术(ate)的结晶,特点是能输出温度数据及相关的温度控制量,适配各种微控制器(mcu)。社会的发展使人们对传感器的要求也越来越高,现在的温度传感器正在基于单片机的基础上从模拟式向数字式,从集成化向智能化、网络化的方向飞速发展,并朝着高精度、多功能、总线标准化、高可靠性及安全性、开发虚拟传感器和网络传感器、研制单片测

8、温系统等高科技的方向迅速发展,本文将介绍智能集成温度传感器ad590的结构特征及控制方法,并对以此传感器,at89c51单片机为控制器构成的数字温度测量装置的工作原理及程序设计作了详细的介绍。与传统的温度计相比,其具有读数方便,测温范围广,测温准确,输出温度采用数字显示,主要用于对测温要求比较准确的场所,或科研实验室使用。该设计控制器使用atmel公司的at89c51单片机,测温传感器使用ad590,用液晶来实现温度显示。第二章 元件简介2.1 ad590温度传感器简介ad590是美国模拟器件公司生产的单片集成两端感温电流源。是一种常用的电流型集成温度传感器。该芯片内部集成了温度传感部分、放大

9、电路、驱动电路和信号处理电路等。性能特点 ad590所输出电流的大小与绝对温度成正比,工作温度范围在-55+150,测量精度为±1,工作电压约4v30v。由于在生产时经过了精密校正,ad590的接口电路十分简单,不需要外围温度补偿和线性处理电路。ad590温度传感器是一种已经ic化的温度感测器,它会将温度转换为电流,在8051的各种课本中经常看到。其规格如下: 1、 温度每增加1,它会增加1a输出电流 2、 可测量范围-55至150 3、 供电电压范围+4v至+30vad590的管脚图及元件符号如图21所示: 图21ad590的输出电流值说明如下:   

10、    其输出电流是以绝对温度零度(-273)为基准,每增加1,它会增加1a输出电流,因此在室温25时,其输出电流iout=(273+25)=298a。       ad590基本应用电路: 图21-2注意事项: 1、 vo的值为io乘上10k,以室温25而言,输出值为10k×298a=2.98v2、 测量vo时,不可分出任何电流,否则测量值会不准。  ad590实际应用电路:图21-3电路分析:      

11、; 1、 ad590的输出电流i=(273+t)a(t为摄氏温度),因此测量的电压v为(273+t)a×10k=(2.73+t/100)v。为了将电压测量出来又务须使输出电流i不分流出来,我们使用电压跟随器其输出电压v2等于输入电压v。       2、 由于一般电源供应教多器件之后,电源是带杂波的,因此我们使用齐纳二极管作为稳压元件,再利用可变电阻分压,其输出电压v1需调整至2.73v       3、 接下来我们使用差动放大器其输出vo为(100k/10k)&#

12、215;(v2-v1)=t/10,如果现在为摄氏28,输出电压为2.8v,输出电压接ad转换器,那么ad转换输出的数字量就和摄氏温度成线形比例关系。2.2 a/d转换器adc0809简介adc0809带有8位a/d转换器、8路多路开关以及微处理机兼容的控制逻辑的cmos组件。它是逐次逼进式a/d转换器,可以和单片机直接接口。图22-11. adc0809的内部结构adc0809的内部逻辑结构图如图22-2所示。图22-2图中多路开关可选通8个模拟通道,允许8路模拟量分时输入,共用一个a/d转换器进行转换,这是一种经济的多路数据采集方法。地址锁存与译码电路完成对a、b、c 3个地址位进行锁存和译

13、码,其译码输出用于通道选择,其转换结果通过三态输出锁存器存放、输出,因此可以直接与系统数据总线相连,表12-1为通道选择表。 表2-2-1adc0809芯片为28引脚为双列直插式封装,其引脚排列见图9.8。对adc0809主要信号引脚的功能说明如下:in7in0模拟量输入通道ale地址锁存允许信号。对应ale上跳沿,a、b、c地址状态送入地址锁存器中。start转换启动信号。start上升沿时,复位adc0809;start下降沿时启动芯片,开始进行a/d转换;在a/d转换期间,start应保持 低电平。本信号有时简写为st.a、b、c地址线。 通道端口选择线,a为低地址,c为高地址,引脚图中

14、为adda,addb和addc。其地址状态与通道对应关系见表9-1。clk时钟信号。adc0809的内部没有时钟电路,所需时钟信号由外界提供,因此有时钟信号引脚。通常使用频率为500khz的时钟信号eoc转换结束信号。eoc=0,正在进行转换;eoc=1,转换结束。使用中该状态信号即可作为查询的状态标志,又可作为中断请求信号使用。d7d0数据输出线。为三态缓冲输出形式,可以和单片机的数据线直接相连。d0为最低位,d7为最高 oe输出允许信号。用于控制三态输出锁存器向单片机输出转换得到的数据。oe=0,输出数据线呈高阻;oe=1,输出转换得到的数据。vcc +5v电源。 vref参考电源参考电压

15、用来与输入的模拟信号进行比较,作为逐次逼近的基准。其典型值为+5v(vref (+)=+5v, vref( -)=-5v).电路连接主要涉及两个问题。一是8路模拟信号通道的选择,二是a/d转换完成后转换数据的传送。图1-2.3 为adc0809与mcs-51的连接图图22.3如图22-3所示模拟通道选择信号a、b、c分别接最低三位地址a0、a1、a2即(p0.0、p0.1、p0.2),而地址锁存允许信号ale由p2.0控制,则8路模拟通道的地址为0fef8h0feffh.adc0809引脚图:图2-2-42.3 at89c51单片机简介  at89c51是一种带4k字节闪烁

16、可编程可擦除只读存储器(fperomfalsh programmable and erasable read only memory)的低电压,高性能cmos8位微处理器,俗称单片机。该器件采用atmel高密度非易失存储器制造技术制造,与工业标准的mcs-51 ? 指令集和输出管脚相兼容。由于将多功能8位cpu和闪烁存储器组合在单个芯片中,atmel的at89c51是一种高效微控制器,为很多嵌入式控制系统提供了一种灵活性高且价廉的方案。 1主要特性:·与mcs-51 兼容·4k字节可编程闪烁存储器寿命:1000写/擦循环数据保留时间:10年·全静态工作:0hz-2

17、4hz·三级程序存储器锁定·128*8位内部ram·32可编程i/o线·两个16位定时器/计数器·5个中断源·可编程串行通道·低功耗的闲置和掉电模式·片内振荡器和时钟电路 2管脚说明:vcc:供电电压。gnd:接地。p0口:p0口为一个8位漏级开路双向i/o口,每脚可吸收8ttl门电流。当p1口的管脚第一次写1时,被定义为高阻输入。p0能够用于外部程序数据存储器,它可以被定义为数据/地址的第八位。在fiash编程时,p0 口作为原码输入口,当fiash进行校验时,p0输出原码,此时p0外部必须被拉高。p1口:p1口

18、是一个内部提供上拉电阻的8位双向i/o口。p2口:p2口为一个内部上拉电阻的8位双向i/o口。p3口:p3口管脚是8个带内部上拉电阻的双向i/o口。p3口也可作为at89c51的一些特殊功能口,如下:p3.0 rxd(串行输入口)p3.1 txd(串行输出口)p3.2 /int0(外部中断0)p3.3 /int1(外部中断1)p3.4 t0(记时器0外部输入)p3.5 t1(记时器1外部输入)p3.6 /wr(外部数据存储器写选通)p3.7 /rd(外部数据存储器读选通)第三章 系统硬件设计显示电路基于at89c51的温度检测系统硬件设计方案如图3-1:温度传感器at89c51a/d转换器信号

19、放大器报警指示图31 感器ad590将外部温度转换为模拟电信号直接以电压形式输出,输入到集成运算放大器中进行放大然后送入到再送入到a/d转换器adc0809中进行模数转换,然后将所得的数字量送入单片机at89c51中进行处理分析一部分输出显示,另一部分输出报警指示。1、温度传感器的选择本设计选择ad590温度传感器其测温范围-55150最大非线性误差为±0.3重复性误差低于±0.05满足系统设计的要求。2、信号放大器图32图323、a/d转换器的选择adc0809主要性能指标:单5v供电,8位,8通道,基准电压可调,转换时间100us,功耗15mw. 符合本设计要求。4、a

20、t89c51的资源分配根据上章对at89c51的功能极其资源分配的介绍,表明此单片机符合本设计要求。表i/o站口功能分配如表31i/o功能引脚分配p0报警输出p0.0p1转换结果输出p2adc0809控制输出控制p2.0:启/停 p2.1:设定 p2.2:字节地址控制 p2.3:设定p3p3.0,p3.1:串行输出到led p3.2:clk输出 p3.3:启动转换 p3.4:转换结果 p3.5:降温控制 p3.6:降温指示 p3.7:运行指示第四章 软件设计程序:本文用at89c51作为核心处理器,其软件设计需要实现四部分功能(1)a/d转换控制将每次搜集的模拟信号数字化;(2)bcd码转化将

21、双字节16进制数转换为3字节的bcd码;(3)温度显示用led显示当前温度;(4)报警指示,将输入的温度于制定温度对比小于则继续比较,大于等于则蜂鸣报警。at89c51的具体流程如图4-1:图411、a/d转换控制根据at89c51的中断分配,利用外部中断int1以查询方式进行a/d转换,输出12位数字信号,其部分汇编程序如下:int1: clrtr0 clr bt setb ce setb rc setb a0 ;低四位并行输出 mov adl ; p0 nop clr a0;高八位并行输出 mov adh;p0clr ce2、 温度检测子程序本系统a/d转换结果乘以2正好是温度值,因此,采

22、样的数字之和除以2就是检测的当前温度,部分程序如下: tadc: mov40h,#00h;清检检测温度缓冲区 movr2,#04h;取样次数送r2 movdptr,#fef0h;指向a/d转换器0通道 tadc0: movxdptr,a;启动转换tadc1: jnbie1,tadc1;等待转换结束 movxa,dptr;读转换结果 adda,40h;累加 mov40h,a djnzr2,tadc0;4次采样完否,未完继续 clrc;累加结果除以2 mova,40h rrca mov40h,a ret3、 温度显示 在设计过程中,采用3为动态led显示当前温度,由于at89c51的i/o口有限,

23、利用74ls164移位寄存器拓展i/o口,将串行输入数据转换成并行输出,其部分程序如下:dsout: mov r0,#8;传送一个字节8位dsloop: rlc a;左移mov dat,c;送数据到数据口setb clk;送一时钟clrclkdjnz r0,dsloopret;返回调用4、温度超限报警子程序alarm:mova,40hclkcsubba,41hjcint1setbf0ajmpdelayalarm0:mova,#45hclrcsubba,40h5、延时程序delay:movr7,#4k3:movr6,#250k2:movr5,#250k1:nopnopdjnzr5,k1djnzr

24、6,k2djnzr7,k3ret第五章 附录1、硬件系 统 硬 件 图2、软件int1: clrtr0 clr bt setb ce setb rc setb a0 ;低四位并行输出 mov adl ; p0 nop clr a0;高八位并行输出 mov adh;p0clr cerettadc: mov40h,#00h;清检检测温度缓冲区 movr2,#04h;取样次数送r2 movdptr,#fef0h;指向a/d转换器0通道 tadc0: movxdptr,a;启动转换tadc1: jnbie1,tadc1;等待转换结束 movxa,dptr;读转换结果 adda,40h;累加 mov40

25、h,a djnzr2,tadc0;4次采样完否,未完继续 clrc;累加结果除以2 mova,40h rrca mov40h,aretint1: clrtr0 clr bt setb ce setb rc setb a0 ;低四位并行输出 mov adl ; p0 nop clr a0;高八位并行输出 mov adh;p0clr ceretalarm:mova,40hclkcsubba,41hjcint1setbf0ajmpdelayalarm0:mova,#45hclrcsubba,40hretdelay:movr7,#4k3:movr6,#250k2:movr5,#250k1:nopnop

26、djnzr5,k1djnzr6,k2djnzr7,k3retend第六章 结束语经过模拟测试,在温度正常范围内,系统读取的温度数与水银温度计读数一致,其差别仅在最后一位,完全符合系统温度小于0.5摄氏度的要求。在温度高于45度时蜂鸣器响起,由于该系统电路简单、集成度高,稳定性好,调试方便成本低,具有一定的实用价值。参考文献:1、楼然苗,李光飞编著. 51系列单片机设计实例. 北京航天航空大学出版社2、先锋工作室. 单片机程序设计实例. 清华大学出版社致 谢随着毕业设计的逐渐完成,离毕业离校的日子也就越来越近了。在这大学三年里,我非常感谢各位老师三年来对我的栽培,以及各位同学朋友对我的帮助,正是

27、由于他们在学习和生活上给予我无微不至的关怀,才使我在这三年期间不仅学到了扎实的专业知识,还学到了很多为人处事的原则。通过这次最后的毕业设计,又使我学到了很多专业知识,实验技能也有了很大的提高,其实,有些事并非我们想的那样难,世上无难事,只怕有心人,只要我们真正用心去做了,你就会发现一切就变得很容易了。虽然感觉自己做的还不是很好吧!但毕竟自己亲自去做了,所以还是有点成就感的。在这次设计中我首先要感谢我的指导老师王莹,我能够顺利地完成这篇设计,很大程度上都要归功于她的细心指导,无论我们开始做的多么差,她都会细心的一个一个的给我们修改。其次,我还要感谢我的同学,感谢他们对我的支持和帮助。我想通过这次

28、设计,对我以后的工作一定会有很大帮助的。最后,我还要感谢我的母校宝鸡职业技术学院,感谢“她”为我提供了一个良好的学习和生活环境。如果没有“她”也就没有今天的我们,即将离开学校,还真有点舍不得,在以后的日子里我会时常想起这里的一幕幕,因为在这里曾经给我留下了太多的喜.怒.哀.乐,有太多的人和事值得我去怀念了。在这即将离开之即,愿我们的母校明天更加美好!employment tribunals sort out disagreements between employers and employees.you may need to make a claim to an employment tr

29、ibunal if:· you don't 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, see dismissal.you can make a claim to an employm

30、ent tribunal, even if you haven't appealed against 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 you must make an appl

31、ication 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 advice from one of the or

32、ganisations listed under further 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 thinking about mak

33、ing a claim to an employment tribunal, you should get help straight away from one of the organisations listed under further 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 win the cas

34、e. this is known as a damages-based agreement. in england and wales, your solicitor can't 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 you're clear about the terms o

35、f 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 by e-mail, click on nearest cab.for more information about making a claim to an employment tribunal, see e

36、mployment tribunals.the (lack of) air up there watch mcayman islands-based webb, the head of fifa's anti-racism taskforce, is in london for the football association's 150th anniversary celebrations and will attend city's premier league match at chelsea on sunday."i am going to be at

37、 the match tomorrow and i have asked to meet yaya toure," he told bbc sport."for me it's about how he felt and i would like to speak to him first to find out what his experience was."uefa has opened disciplinary proceedings against cska for the "racist behaviour of

38、their fans" during city's 2-1 win.michel platini, president of european football's governing body, has also ordered an immediate investigation into the referee's actions.cska said they were "surprised and disappointed" by toure's complaint. in a statement the russ

39、ian 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 disillusionm

40、ent, 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 life trajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很

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

42、 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 alumni in peace, suddenly found that isn't really grow up, it seems is not so important; then in high school, think don't want to give ven

43、t 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 again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already can't re

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

45、 to an event, in addition to resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。a person's 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 o

46、ut 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 oneself give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定

47、了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。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

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

49、umgartner 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 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 than the cruising altitude of commercial

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论