基于单片机的多功能温度检测系统的设计翻译.docx

上传人:b****3 文档编号:24853334 上传时间:2023-06-02 格式:DOCX 页数:8 大小:34.92KB
下载 相关 举报
基于单片机的多功能温度检测系统的设计翻译.docx_第1页
第1页 / 共8页
基于单片机的多功能温度检测系统的设计翻译.docx_第2页
第2页 / 共8页
基于单片机的多功能温度检测系统的设计翻译.docx_第3页
第3页 / 共8页
基于单片机的多功能温度检测系统的设计翻译.docx_第4页
第4页 / 共8页
基于单片机的多功能温度检测系统的设计翻译.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

基于单片机的多功能温度检测系统的设计翻译.docx

《基于单片机的多功能温度检测系统的设计翻译.docx》由会员分享,可在线阅读,更多相关《基于单片机的多功能温度检测系统的设计翻译.docx(8页珍藏版)》请在冰豆网上搜索。

基于单片机的多功能温度检测系统的设计翻译.docx

基于单片机的多功能温度检测系统的设计翻译

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

一、

引言

  随着社会的发展和技术的进步,人们越来越注重温度检测与显示的重要性。

温度检测与状态显示技术与设备已经普遍应用于各行各业,市场上的产品层出不穷。

温度检测及显示也逐渐采用自动化控制技术来实现监控。

本课题就是一个温度检测及状态显示的监控系统。

二、系统方案

  本系统采用AT89S52作为该系统的单片机。

系统整体硬件电路包括,电源电路,传感器电路,温度显示电路,上下限报警电路等如图1所示。

图中报警电路可以在被测温度不在上下限X围内时,发出报警鸣叫声音。

温度控制的基本原理为:

当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)可用数据线供电,电压X围从3.0V到5.5V。

(5)可测量的温度X围从-55℃到+125℃,增量值0.5℃;华氏温度X围从-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当前的温度、温度数据转化成液晶字符显示等程序。

五、小结

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

  本文介绍了以DSl8B20新型数字温度传感器、AT89S52单片机、LCD1602液晶显示模块为主体构建的温度检测显示系统。

说明了系统硬件电路、系统主程序与各模块子程序的设计。

本系统采用的是DALLAS公司推出的数字式温度传感器DS18B20,无需外加A/D即可输出数字量,把温度信号直接转换成串行数字信号供微机处理。

因此。

该系统具有硬件电路结构简单、转换精度高、显示结果清晰稳定、成本低等显着优点。

在诸如粮库测温、智能建筑、中央空调等多种需要温度检测的场合具有较好的应用前景。

 

BasedonSCMmulti-functionaltemperaturetestingsystemdesign

1、preface

Withthedevelopmentofsocietyandthetechnologicalprogress,peoplepaymoreandmoreattentiontotheimportanceoftemperaturedetectionanddisplay.Temperaturedetectionandstatusdisplaytechnologyandequipmenthasbeenwidelyappliedinindustries,productsonthemarketemergeinendlessly.Temperaturetestingandalsograduallyadopttheautomaticcontroltechnologytorealizethemonitor.Thistopicisatemperaturetestingandstatusofthemonitoringsystem.

2、Systemsolutions

ThissystemUSESthemonolithicintegratedcircuitAT89S52asthissystem.Thewholesystem,thehardwarecircuitincludingpowersupplycircuit,sensor,thetemperaturedisplaycircuitcircuit,upperalarmcircuitsuchasshowninfigure1.Figureinthealarmingcircuitcanbemeasuredinuppertemperaturerange,screamingvoicealarm.ThebasicprincipleforthetemperaturecontrolDSl8B20:

whenthetemperaturesignalacquisitiontoaftertemperaturesignalsenttohandle,AT89S52temperaturetoLCDscreen,SCMaccordingtoinitializetheuppertemperaturesetting,namely,ifthejudgementoftemperaturethanthehighesttemperaturecoolingfanisstarted,Ifthetemperatureislessthanthelowesttemperaturesettingonalarmdevice.Temperaturecontrollerdiagram

3、Thesystemhardwaredesign

(1)AT89S52SCMareintroduced

AT89S52devicesisalowpowerconsumption,highCMOS8bitmicro-controller,8KprogrammableFlashmemory.UseAtmelpanyhigh-densitynonvolatilestoragetechnology,andindustrial80C51productinstructionandpinfullypatible.TheFlashmemorychipsallowsprogramsinsystemprogramming,alsosuitableforconventionalprogramming.Inasinglechip,haveclever8bitsCPUandprogrammableFlashinthesystem,formanyembeddedcontrolAT89S52applicationsystemprovidesahighlyflexible,efficientsolutions[5].AT89S52hasthefollowingfunctions:

thestandard256bytes,8kbyteFlashRAM,32I/Oport,thewatchdogtimer,2data,threepointer16timer/counter,a6vectorlevel2interruptstructure,full-duplexserial,timelyclockcircuitwithincrystals.Inaddition,0HzAT89S52candroptothestaticlogicoperation,supporttwosoftwarecanchoosepowersavingmode.Idlemode,theCPUtostopworking,andallowstheRAM,timer/counters,serial,continuetowork.Protectionmode,RAMbyMCU,oscillatorisfrozen,alltheworktostopuntilthenextinterruptionorhardwarereset.

(2)ThesensorDS18B20

Inthetraditionalanalogsignaldistancetemperaturemeasuringsystem,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.

①.DSl8B20principleofwork

TheinternalstructureofDS18B20DSl8B20temperaturemeasurementprinciplediagramshowninfigure3.2.Lowtemperaturecoefficientgraphoscillationfrequencyvibrationproducttemperatureisusedtoproducewithfixedfrequency,pulsesignaltocounterl.Hightemperaturecoefficientcrystalstemperature-dependentitsoscillationfrequencychangesignificantly.Thesignalgeneratedasthecounter2inputpulses.Counter1,2andtemperatureregistersarecounterin-55degreespresetcorrespondingabasevalue.Counterltolowtemperaturecoefficientofthepulsesignalgeneratedcrystals,whenthecounterforsubtractioncountingthepresetvaluereducedto1,whenthetemperaturecounterOvaluewilladdl,counterthepresetvaluewillbelmanagain,tocounterthelstartlowtemperaturecoefficientofcrystaloscillatorpulsesignal,socyclecountuntilthecounter2,stopcountingtoOaccumulativetemperature,temperatureoftheregisterfortheregisterismeasuredvalues.Figure3.2accumulativeusedfortheslopepensationandfixedtemperaturemeasurement,theoutputoftheprocessofnonlinearcorrectionislessthanthepresetvaluecounterl.

②.AT89S52interfacemodeandDS18B20

ChipDS18B20andtheconnectionhastwokinds:

namelyparasiticpowerandexternalpowersupplymode.

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.

Theexternalpowersourcesupplyway:

intheexternalpowersupplymodes,DS18B20workpowerbyVDDpin,I/Oaccesslinedoesnotneedstrongpullup,thereisnoshortageofelectricitypower,canensureaccuracyandconversioninthebustheorycanbea

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

当前位置:首页 > 小学教育 > 小学作文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1