基于单片机的多功能温度检测系统的设计翻译_第1页
基于单片机的多功能温度检测系统的设计翻译_第2页
基于单片机的多功能温度检测系统的设计翻译_第3页
基于单片机的多功能温度检测系统的设计翻译_第4页
基于单片机的多功能温度检测系统的设计翻译_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

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

文档简介

.z基于单片机的多功能温度检测系统的设计引言

随着社会的开展和技术的进步,人们越来越注重温度检测与显示的重要性。温度检测与状态显示技术与设备已经普遍应用于各行各业,市场上的产品层出不穷。温度检测及显示也逐渐采用自动化控制技术来实现监控。本课题就是一个温度检测及状态显示的监控系统。二、系统方案

本系统采用AT89S52作为该系统的单片机。系统整体硬件电路包括,电源电路,传感器电路,温度显示电路,上下限报警电路等如图1所示。图中报警电路可以在被测温度不在上下限*围内时,发出报警鸣叫声音。温度控制的根本原理为:当DSl8B20采集到温度信号后,将温度信号送至AT89S52中处理,同时将温度送到LCD液晶屏显示,单片机根据初始化设置的温度上下限进展判断处理,即如果温度大于所设的最高温度就启动风扇降温;如果温度小于所设定的最低温度就启动报警装置。温度控制器的原理图二三、系统硬件设计1.单片机AT89S52的介绍

AT89S52是一种低功耗、高性能CMOS8位微控制器,具有8K可编Flash存储器。使用Atmel公司高密度非易失性存储器技术制造,与工业80C51产品指令和引脚完全兼容。片上Flash允许程序存储器在系统编程,亦适于常规编程器。在单芯片上,拥有灵巧的8位CPU和在系统可编程Flash,使AT89S52为众多嵌入式控制应用系统提供高灵活、超有效的解决方案[5]。AT89S52具有以下标准功能:8k字节Flash,256字节RAM,32位I/O口线,看门狗定时器,2个数据指针,三个16位定时器/计数器,一个6向量2级中断构造,全双工串行口,片内晶振及时钟电路。另外,AT89S52可降至0Hz静态逻辑操作,支持2种软件可选择节电模式。空闲模式下,CPU停顿工作,允许RAM、定时器/计数器、串口、中断继续工作。掉电保护方式下,RAM内容被保存,振荡器被冻结,单片机一切工作停顿,直到下一个中断或硬件复位为止。

2.DS18B20传感器的介绍

在传统的模拟信号远距离温度测量系统中,需要很好的解决引线误差补偿问题、多点测量切换误差问题和放大电路零点漂移误差问题等技术问题,才能够到达较高的测量精度。另外一般监控现场的电磁环境都非常恶劣,各种干扰信号较强,模拟温度信号容易受到干扰而产生测量误差,影响测量精度[5]。因此,在温度测量系统中,采用抗干扰能力强的新型数字温度传感器是解决这些问题的最有效方案,与其它温度传感器相比DSl820具有以下特点:

(1)独特的单线接口方式。DSl820在与微处理器连接时仅需要一条接口线即可实现微处理器与DSl820的双向通讯。(2)多点功能简化了分布式温度检测的应用。(3)DSl820在使用中无需任何外围元件。(4)可用数据线供电,电压*围从3.0V到5.5V。(5)可测量的温度*围从-55℃到+125℃,增量值0.5℃;华氏温度*围从-67到+257,增量值0.9。(6)支持多点组网功能。多个DS1820可以并接在同一条总线上,实现多点测温。(7)9位的温度分辨率。测量结果以9位数字量方式串行传送。(8)用户可设定温度报警门限值。(9)有超温度搜寻功能。

〔1〕DSl8B20的工作原理

DS18B20的内部构造DSl8B20的测温原理框图如图3.2所示。图中低温度系数品振的振荡频率受温度影响很小,用于产生同定频率的脉冲信号送给计数器l。高温度系数晶振随温度变化其振荡频率明显改变。所产生的信号作为计数器2的脉冲输入。计数器1、计数器2和温度存放器被预置在-55℃所对应的一个基数值。计数器l对低温度系数晶振产生的脉冲信号进展减法计数,当计数器1的预置值减到O时,温度计数器的值将加l,计数器l的预置值将被重新装人,计数器l重新开场对低温度系数晶振产生的脉冲信号进展计数,如此循环直到计数器2计数到O时,停顿温度存放器的累加,此时温度存放器中的数值即为所测温度。图3.2中的斜率累加器用于补偿和修正测温过程中的非线性,其输出小于修正计数器l的预置值。

〔2〕DS18B20与AT89S52的接口方式

DS18B20与单片机的连接方式有两种:即寄生电源方式和外部电源方式。

寄生电源方式:在寄生电源供电方式下,DS18B20从单线信号线上汲取能量:在信号线DQ处于高电平期间把能量储存在内部电容里,在信号线处于低电平期间消耗电容上的电能工作,直到高电平到来再给寄生电源〔电容〕充电。寄生电源方式有三个好处:1〕进展远距离测温时,无需本地电源。2〕可以在没有常规电源的条件下读取ROM。3〕电路更加简洁,仅用一根I/O口实现测温。要想使DS18B20进展准确的温度转换,I/O线必须保证在温度转换期间提供足够的能量,由于每个DS18B20在温度转换期间工作电流到达1mA,当几个温度传感器挂在同一根I/O线上进展多点测温时,只靠4.7K上拉电阻就无法提供足够的能量,会造成无法转换温度或温度误差极大。

外部电源供电方式:在外部电源供电方式下,DS18B20工作电源由VDD引脚接入,此时I/O线不需要强上拉,不存在电源电流缺乏的问题,可以保证转换精度,同时在总线上理论可以挂接任意多个DS18B20传感器,组成多点测温系统。

本系统采用外部电源方式。连接方法即DS18B20的1脚接地,2脚(DQ引脚)与AT89S52的一根I/O口线相连,3脚接+5V。在A89S52的I/O口线与+5V之间连接一4.7K的上拉电阻,以保证数据采集的正常进展。假设要组成多点温度检测系统,可在单片机的同一根I/O口线上,以一样的连接方法并联多片DS18B20芯片。

3、LCD1602液晶屏

1602液晶显示模块可以和单片机AT89S52直接接口。4、蜂鸣器驱动电路

由于蜂鸣器的工作电流一般比较大,以致于单片机的I/O口是无法直接驱动的,所以要利用放大电路来驱动,一般使用三极管来放大电流就可以了。当所测的温度低于6摄氏度时,报警。

5、风扇电路

当所测的温度高于80摄氏度时,启动风扇电路。因为工作电流比较大,所以用放大电路来驱动,即用三极管来放大电流就可以了。当温度高于80℃时,给单片机一个命令,单片机P2.6引脚输出高电平,三极管导通,风扇电路接通,电风扇开场转动,从而起到降温作用。

四、系统的软件设计

本系统采用AT89S52作为核心处理器件,把经过DSl8B20现场实时采集到的温度数据,存入AT89S52的内部数据存储器,送液晶显示,并与预先设定值进展比较,然后由单片机输出信号去控制风扇电路和报警电路。多功能温度检测显示系统软件主要包括:函数声明、延迟时间函数、DS18B20初始化函数、读出DS18B20当前的温度、温度数据转化成液晶字符显示等程序。五、小结

随着工业的不断开展,对温度测量的要求来越高,而且测量*围也越来越广,因此对温度检测技术的要求也越来越高。

本文介绍了以DSl8B20新型数字温度传感器、AT89S52单片机、LCD1602液晶显示模块为主体构建的温度检测显示系统。说明了系统硬件电路、系统主程序与各模块子程序的设计。本系统采用的是DALLAS公司推出的数字式温度传感器DS18B20,无需外加A/D即可输出数字量,把温度信号直接转换成串行数字信号供微机处理。因此。该系统具有硬件电路构造简单、转换精度高、显示结果清晰稳定、本钱低等显着优点。在诸如粮库测温、智能建筑、中央空调等多种需要温度检测的场合具有较好的应用前景。BasedonSCMmulti-functionaltemperaturetestingsystemdesign1、prefaceWiththedevelopmentofsocietyandthetechnologicalprogress,peoplepaymoreandmoreattentiontotheimportanceoftemperaturedetectionanddisplay.Temperaturedetectionandstatusdisplaytechnologyandequipmenthasbeenwidelyappliedinindustries,productsonthemarketemergeinendlessly.Temperaturetestingandalsograduallyadopttheautomaticcontroltechnologytorealizethemonitor.Thistopicisatemperaturetestingandstatusofthemonitoringsystem.2、SystemsolutionsThissystemUSESthemonolithicintegratedcircuitAT89S52asthissystem.Thewholesystem,thehardwarecircuitincludingpowersupplycircuit,sensor,thetemperaturedisplaycircuitcircuit,upperalarmcircuitsuchasshowninfigure1.Figureinthealarmingcircuitcanbemeasuredinuppertemperaturerange,screamingvoicealarm.ThebasicprincipleforthetemperaturecontrolDSl8B20:whenthetemperaturesignalacquisitiontoaftertemperaturesignalsenttohandle,AT89S52temperaturetoLCDscreen,SCMaccordingtoinitializetheuppertemperaturesetting,namely,ifthejudgementoftemperaturethanthehighesttemperaturecoolingfanisstarted,Ifthetemperatureislessthanthelowesttemperaturesettingonalarmdevice.Temperaturecontrollerdiagram3、Thesystemhardwaredesign〔1〕AT89S52SCMareintroducedAT89S52devicesisalowpowerconsumption,highCMOS8bitmicro-controller,8KprogrammableFlashmemory.UseAtmelpanyhigh-densitynonvolatilestoragetechnology,andindustrial80C51productinstructionandpinfullypatible.TheFlashmemorychipsallowsprogramsinsystemprogramming,alsosuitableforconventionalprogramming.Inasinglechip,haveclever8bitsCPUandprogrammableFlashinthesystem,formanyembeddedcontrolAT89S52applicationsystemprovidesahighlyfle*ible,efficientsolutions[5].AT89S52hasthefollowingfunctions:thestandard256bytes,8kbyteFlashRAM,32I/Oport,thewatchdogtimer,2data,threepointer16timer/counter,a6vectorlevel2interruptstructure,full-duple*serial,timelyclockcircuitwithincrystals.Inaddition,0HzAT89S52candroptothestaticlogicoperation,supporttwosoftwarecanchoosepowersavingmode.Idlemode,theCPUtostopworking,andallowstheRAM,timer/counters,serial,continuetowork.Protectionmode,RAMbyMCU,oscillatorisfrozen,alltheworktostopuntilthene*tinterruptionorhardwarereset.〔2〕ThesensorDS18B20Inthetraditionalanalogsignaldistancetemperaturemeasuringsystem,needgoodsolveleaderrorpensation,multi-pointmeasurementerrorandamplifyingcircuitswitchingtechnologiessuchaszerodrifterrorproblem,canachievehighmeasuringaccuracy.Anothergeneralmonitoringsiteoftheelectromagneticenvironmentisverybad,allkindsofjammingsignalisstronger,thesimulatedtemperaturesignalinterferenceandvulnerabletoproducemeasurementerrorandmeasuringprecision[5].Therefore,intemperaturemeasuringsystem,thestronganti-jammingcapabilityofthenewdigitaltemperaturesensoristhemosteffectivetosolvetheseproblems,paredwithothertemperaturesensorDSl820hasthefollowingfeatures:(1)theuniquesinglelineinterfaceway.DSl820inconnectionwiththemicroprocessoronlyneedoneinterfacetoimplementlineDSl820microprocessorsandtwo-waymunication.(2)morefunctionsimplifiesdistributedtemperaturedetectionapplication.(3)DSl820inusewithoutanyperipheraldevices.(4)power,voltagerangedataavailablefrom3.0Vto5.5V.(5)canmeasuretemperaturerangefrom-55degreesc++to125,incrementalvalue0.5°c,Fahrenheittemperaturerangefrom-67to+257,incrementalvalue0.9.(6)supportmulti-pointnetworkfunction.MultipleDS1820canpickonthesamebusand,moretemperaturemeasurement.(7)9temperatureresolution.Measuringresultsinnineserialtransmissionwaythedigitalquantity.(8)usercansettemperaturealarmthreshold.(9)havesupertemperaturesearchfunction.①.DSl8B20principleofworkTheinternalstructureofDS18B20DSl8B20temperaturemeasurementprinciplediagramshowninfigure3.2.Lowtemperaturecoefficientgraphoscillationfrequencyvibrationproducttemperatureisusedtoproducewithfi*edfrequency,pulsesignaltocounterl.Hightemperaturecoefficientcrystalstemperature-dependentitsoscillationfrequencychangesignificantly.Thesignalgeneratedasthecounter2inputpulses.Counter1,2andtemperatureregistersarecounterin-55degreespresetcorrespondingabasevalue.Counterltolowtemperaturecoefficientofthepulsesignalgeneratedcrystals,whenthecounterforsubtractioncountingthepresetvaluereducedto1,whenthetemperaturecounterOvaluewilladdl,counterthepresetvaluewillbelmanagain,tocounterthelstartlowtemperaturecoefficientofcrystaloscillatorpulsesignal,socyclecountuntilthecounter2,stopcountingtoOaccumulativetemperature,temperatureoftheregisterfortheregisterismeasuredvalues.Figure3.2accumulativeusedfortheslopepensationandfi*edtemperaturemeasurement,theoutputoftheprocessofnonlinearcorrectionislessthanthepresetvaluecounterl.②.AT89S52interfacemodeandDS18B20ChipDS18B20andtheconnectionhastwokinds:namelyparasiticpowerande*ternalpowersupplymode.Parasiticpowerway:intheparasiticpowersupplymode,thesignalfromthesinglechipDS18B20inlinedrawingenergyduringthehighlevelintheDQenergystoredintheinternalcapacitance,lowlevelinsignalintheenergyconsumedduringthecapacitanceonworkinguntilhigh-levelingagaintoparasiticpower(battery).Parasiticpowermodehasthreeadvantages:1)distancemeasuringtemperature,withoutthelocalpowersupply.2)noconventionalpowerintheconditionreadstheROM.3)circuit,withonlyonemoreconciserootI/Orealizetemperaturemeasurement.WanttomakeprecisetemperatureconversionchipDS18B20,I/Olinemustensurethatthetemperatureconversionperiod,duetoprovideenoughenergyconversionintemperatureduringeachDS18B20,whenthecurrent1mAtoworkafewtemperaturesensorinthesameroothangingontheI/Omulti-pointtemperaturemeasurement,onlyby4.7Kandresistancewillnotbeabletoprovideenoughenergy,whichcannotbeswitchovertemperatureorerrors.Thee*ternalpowersourcesupplyway:inthee*ternalpowersupplymodes,DS18B20workpowerbyVDDpin,I/Oaccesslinedoesnotneedstrongpullup,thereisnoshortageofelectricitypower,canensureaccuracyandconversioninthebustheorycanbearticulatedmultiplesensorDS18B20,multipointtemperaturemeasuringsystem.ThissystemUSESthee*ternalpowersource.ConnectionmethodisonefootgroundingandDS18B202feet(DQ)andAT89S52footanI/Oport,3feetlineup+5V.A89S52intheI/Oportand+5Vconnectionbetweena4.7Kpull-upresistors,toensurethenormaloperationofthedatacollection.Ifyouwanttotestsystem,posedmulti-pointtemperatureinthesamerootchipI/Oportinthesameline,andthemethodofconnectingtheparallelmorepiecesofDS18B20chip.〔3〕LCD1602LCD1602LCDmodulecanandmonolithicintegratedcircuitAT89S52directlyinterface.〔4〕BuzzerdrivercircuitDuetotheworkingcurrentbuzzerisparedmonlybig,soI/Omicrocontrollerisnotdirectlydrivenbyamplifyingcircuit,soitisgenerallyusedtodrive,toenlargecurrenttransistor.Whenthetemperatureisbelowsi*degreesCelsius,alarm.〔5〕FancircuitWhenthetemperatureishigherthan80°c,startfancircuit.Becausethejobisgreat,sousecurrentamplifiercircuittodrive,toenlargecurrenttransistor.Whenthetemperatureisabove80°c,giveamand,P2.6single-chipmicrocontrollerfootoutputlevel,triodeconduction,fans,electriccircuit,whichbegantoturnitdown.4、ThedesignofthesoftwaresystemThissystemUSESAT89S52devicesasthecore,withDSl8B20afterthecollecteddata,andthetemperatureinsidethedatastorageAT89S52deposit,LCDdisplay,andparedwiththepriorvalue,andthentheoutputsignalbyMCUco

温馨提示

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

最新文档

评论

0/150

提交评论