AT89C52单片机的数字温度计的设计

ATVIIIIXCVII单片机的数字温度计的设计
摘要:
本文介绍了I.种数字温度计实现温度显示的设计,该设计使用ATVIIIIXCVII单片机作为主控制器,DSI.VIIIBII0作为温度传感器,和III个LED数字阳极管进行数据传输.其硬件电路包括主控制器,测温电路和显示电路.与传统的温度计相比具有阅读方便,温度范围广,温度测量精确高,温度数字显示输出成本低和易于操作等优点.目前该温度计主要用于I.些需要精确温度测量的地方或研究实验室.
关键字:组成;温度计;温度控制器传感器
温度不仅是I.个重要的物理参数,也是I.个从古至今都运用于农业,现代科学研究和各种高新技术的开发和测量参数研究的重要物理量.随着时代的进步与发展,单片机和传感器技术已经蔓延到各种领域.本设计正是单片机的数字温度计控制.它使用ATVIIIIXSVII单片机控制器实现温度显示,采用DSI.VIIIBII0和III个LED数码管温度传感器实现数据传输.除此之外这也是I.个多功能温度计,可设置温度上下限报警.与传统的温度计比较,也具有阅读方便,温度测量广,温度测量准确等优点.输出的数字显示系统简单和经济,运行可靠,环境友好.这些优点将让它灵活运用于日常生活和工作和设计科学中.
I..设计原则
作为I.个温度测量电路的设计,传统的方法是利用感温热敏电阻将随着测量温度的变化而变化的电压或电流采集下来.A/D转换后,将数据送入单片机处理,然后,测得的温度将显示在显示器上.这种设计需要使用A/D转换电路和温度电路,过程非常复杂.因此,我采用温度传感器的设计方法.温度传感器被广泛的应用在大多数单片机电路设计之中.通过使用DSI.VIIIBII0温度,测得的温度可以直接阅读,满足设计要求.
II.系统硬件结构
图I..硬件结构
图II.整体系统图 *好棒文|www.hbsrm.com +Q: ^3^5^1^9^1^6^0^7^2^* 

A.ATVIIIIXSVII单片机
ATVIIIIXSVII是I.种以美国ATMEL公司生产的在微型计算机低功耗,高性能CMOSVIII位单片机,强大的ATVIIIIXSVII可以提供具有成本效益的许多嵌入式控制应用的解决方案系统.此外,该芯片还具有III包PDIP,TQFP和PLCC以满足不同的需要.
图III.ATVIIIIXSVII单片机引脚图
主要特点:
?兼容MCS-VI.指令集?VIIIK可以反复重写(>I.000)ISP闪存ROM
?IIIII双向I/O?IV.V-V.Vv工作电压
?III个I.VI位可编程定时器/计数器?0-IIIIIImhz时钟频率
?全双工UART串口中断线?IIVVI×VIIIbit的内部RAM
?II外部中断源?低功耗空闲节电模式
?中断唤醒省电模式?III级加密位
?看门狗(看门狗)电路?空闲节电软件的功能设置
?灵活的ISP字节和页编程
B.温度传感器DSI.VIIIBII0
DSI.VIIIBII0数字温度计是达拉斯I.种种单产生的温度传感器,即单总线器件.它具有的特点包括电路简单,体积小和广泛的应用电压.现场温度I.线总线"数字方式直接传输,大大增强的抗干扰系统.该数字温度计很适合在恶劣环境进行温度测量.
产品的主要特点是:
?只有I.个端口需要实现通信.
?每个组件的DSI.VIIIBII0具有独特的序列数.
?实现温度测量无外组件.
?测量温度范围在-VV℃到+I.IIV℃.
?数字温度计的用户可以选择上限和下限报警.
图IV.sI.VIIIbII0底视图
tablei(底视图)引脚功能描述DSI.VIIIBII0
序号名字引脚功能描述
I.GND接地信号
IIDQ数据输入/输出引脚.开漏单总线接口引脚.当使用与寄生功率的,他们仍然可以为设备提供电源.
IIIVDO可选的VDD引脚.工作时寄生电源,该引脚必须接地.
DSI.VIIIBII0的内部结构主要有IV个组成:VIIV位光刻ROM,温度传感器,非易失性温度报警触发器TH和TL,配置寄存器.DSI.VIIIBII0温度传感器可以测量温度.以I.II位转换为I.个I.VI位的II进制补码的符号扩展设置阅读;0.0VIIIV℃/LSB的形式的表达,其中S是I.个标志位.
图V.I.II位转换图标
这是I.个I.II位的数据转移后存储在两个VIII位II进制I.VIIIBII0RAM,在前面V个是符号位,如果测量温度大于0,那么转换为V0,如果将由0.0VIIIV的测量值在实际中的温度如果不到0.V到I.,实测值反转换是必要的,然后由I.个实际的在0.0VIIIV的温度表示.例如,℃输出0VIId0h数+I.IIV,+IIV.0VIIIV的0I.IXI.h℃数字输出,-IIV.0VIIIV℃数字输出ffVIfh,VV℃数字输出fcIX0h.
III.系统软件的设计与实现
本设计的软件功能的实现汇编语言.下列程序集锦功能:显示温度的实时数据,设定在任何时间,温度极限,警报会响的时候温度超过设定值.的这些功能的完成是通过以下步骤:实时数据的采集和传输,数据经过交叉单片机系统为数值型和与设定值进 *好棒文|www.hbsrm.com +Q: ^3^5^1^9^1^6^0^7^2^* 
行比较.送数码管显示报警和发送到数字控制.程序流程图如下图VI.
初始化程序与程序的其他部分
如下:
org0000H循环开始
org000IIIH循环调整
开机初始化:定义初始地址,得到高的p0pI.pIIpIII集I.,在RVII设定的温度值在店内,将允EA集串口中断
将ex0设置允许外部中断.
----开机初始化------
启动:MOVSP,#VI0h
MOVP0,#0FFH
MOVPI.,#0FFH
MOVPII,#0FFH
MOVPIII,#0FFH
MOVRVII,#II0
SETBEA
ex0SETB
复位初始化的PIII.III口:清除组I.,温度传感器
数据复位
-----复位初始化------
rstI.VIIIbII0:SETBPIII.III
NOP
CLRPIII.III
MOVR0,#0VIbh
MOVrI.,#0IIIH
dsrI.:djnzR0,dsrI.
MOVR0,#关键字:VIBH
djnzRI.,dsrI.
SETBPIII.III
NOP
NOP
NOP
MOVR0,#IIVH
dsrII:PIII.III,dsrIII
djnzR0,dsrII
循环dsrIV
dsrIII:SETB00H
循环dsrV
dsrIV:CLR00H
循环dsrVII
dsrV:MOVR0,#关键字:VIBH
dsrVI:djnzR0,dsrVI
dsrVII:SETBPIII.III
RET
随着现代工业技术的需要,对温度测量技术不断改进.本文介绍了I.种数字温度计的微机控制,其上.下限报警温度可以设定.设计的系统具有很强的抗干扰能力,灵活方便,甚至可以在恶劣环境中使用.该设计具有较高的实用意义.
参考文献
[I.]Motorola.MotorolaGPSProduct-OncoreUser’sGuide(RivisionV.0)[M].USA:MotorolaInc,II00II.
[II]MIKKOS.WaterhydraulicactuatorsforITERmaintenancedevices[J].FusionEngineeringandDesign,II00III,VIIX(I.-IV):I.IVI.-I.IVV.
[III]LIMGHCHUAP.Modernwaterhydraulics-thenewenergytransmissiontechnologyinfluidpower[J].AppliedEnergy,II00III,VIIVI(I.-III):IIIIIIX-IIIVVI.
[IV]NationalInstrumentsCorporation[M].faceReferenceManual.I.IXIXVIII,IIV-IIIVIII.
II0I.0InternationalConferenceonElectricalandControlEngineering
DesignofdigitalthermometerbasedonATVIIIIXCVII
SingleChipMicrocontroller
ZhangQian
DezhouVocationalandTechnicalCollege
Dezhou,Shandong,China
wyhI.I.0I.@I.IIVI.com
Abstract_thispaperintroducesanewdesignmethodofdigitalthermometertoachievetemperaturedisplay,whichusesATVIIIIXCVIIasthemaincontroldevice,DSI.VIIIBII0asthetemperaturesensor,andanodewithatotalofthreeLEDdigitaltubetotransmitdata.Itshardwarecircuitincludesthemaincontroller,temperaturemeasurementcircuitanddisplaycircuit.
Comparedwiththetraditionalthermometer,ithassomestrongpointssuchasconvenientreading,widerangeoftemperaturemeasurement,andaccuratetemperaturemeasurement.Itstemperatureoutputisdisplayeddigitally.Withthefeaturesoflow-costandeasy-handling,it’smainlyusedinsomeplacesrequiringaccuratetemperaturemeasurementorresearchLaboratories.
Keywords-component;digitalthermometer;controller;temperatureSensor
Temperatureisnotonlyacriticalphysicalparameterinindustrybutalsoatraditionaltemperaturemeasurementmethodwhichiscommonlyusedinagriculture,modernscientificresearchandavarietyofhigh-techdevelopmentandresearchtomeasureparameters.Traditionaltemperature
thermometercannotmeettherequirementsoftemperaturemeasurement.Asthetimes’progressanddevelopment,microcontrollerandsensortechnologyhasspreadtovariousfields.Thisdesignisadigitalthermometerbasedonmicrocontroller-basedcontrol.ItachievestemperaturedisplaywiththecontrollerusingmicrocontrollerATVIIIIXSVII,
temperaturesensorsusingDSI.VIIIBII0andIIILEDdigitaltubetransmittingdata.Itisalsoamulti-functionalthermometer,whichcanbesettheuppertemperaturelimitalarm.Comparingwiththetraditionalthermometer,thedigitalthermometerhassomestrongpointssuchasconvenientreading,widerangeoftemperaturemeasurement,andaccuratetemperaturemeasurement.Thedigitaldisplaysystemfortheoutputofthetemperatureissimpleandeconomic,operationreliableandenvironmentalfriendly.Itwillbemainlyusedinvariousfieldssuchasdailylife,work,scienceandresearchafterdesign.
I.DESIGNPRINCIPLES
Mydesignisatemperaturemeasurementcircuit.Thetraditionalwayistousethetemperaturesensingeffectofthethermistortocollectthetemperatureasthevoltageorcurrentchangeswiththemeasuredtemperature.AfterA/Dconversion,thedatawillbesentintothemicrocontrollertoprocess,andthenthemeasuredtemperaturewillbedisplayedontheshowcircuit.ThiskindofdesignneedstouseA/Dconversioncircuitandthetemperaturecircuitisverycomplicated.Therefore,inmydesignthetemperaturesensorisadopted.Temperature
sensorsarewidelyusedinmostsingle-chipcircuitdesign.Byusingatemperaturesensor-DSI.VIIIBII0,themeasuredtemperaturecanbereaddirectlyandeasily,andthenbeconvertedtomeetthedesignrequirements.
II.SYSTEMHARDWARESTRUCTURE
FigureI..HardwareStructure
FigureII.OverallSystemDiagram
A.ATVIIIIXSVIIMicrocontroller
ATVIIIIXSVIIisalow-power,high-capabilityCMOSVIII-bitmicrocontrollerproducedbyATMELCompanyofUSA.ApowerfulATVIIIIXSVIIinthemicro-computerscanprovidecosteffectivesolutionformanyembeddedcontrolapplicationssystem.Inaddition,thechipalsohasthreepackages-PDIP,TQFPandPLCCtomeetdifferentdemands.
FigureIII.ATVIIIIXSVIIPinMap
Mainfeatures:
?CompatiblewithMCS-VI.instructionset
?VIIIkcanberepeatedlyrewritten(>I.000)ISPFlashROM
?IIIIItwo-wayI/O
?IV.V-V.VVoperatingvoltage
?ThreeI.VI-bitprogrammabletimer/counter
?0-IIIIIIMHzclockfrequency
?Full-duplexUARTserialportinterruptline
?IIVVI*VIIIbitinternalRAM
?IIexternalinterruptsources
?Low-poweridleandpower-savingmode
?Interruptwake-uppower-savingmode
?Threelevelsofencryptionbits
?Watchdog(WDT)circuit
?Idleandpower-savingfunctionofthesoftwaresetup
?FlexibleISPbytesandPageProgramming
B.TemperatureSensorDSI.VIIIBII0
DSI.VIIIBII0digitalthermometerisaI.-WireproducedbyDALLAS,i.e.asingle-busdevice.Itpossessescharacteristicsincludingsimplecircuit,smallersize,widerapplicationofvoltageandmoreeconomical.Theon-sitetemperatureistransmitteddirectlyby"busline"digitalmode,whichgreatlyenhancedtheanti-jammingsystem.It’ssuitableforon-sitetemperaturemeasurementinharshenvironmentssuchas:environmentalcontrol,equipmentorprocesscontrol,electronicconsumableswhichneedtemperaturemeasurement.
Themainfeaturesofproductsare:
?Onlyoneportneededtoachievecommunication.
?EachcomponentoftheDSI.VIIIBII0hasauniqueserialnumber
?Realizetemperaturemeasurementwithoutexternalcomponents.
?Measuringtemperaturerangebetween-VV℃and+I.IIV℃.
?DigitalthermometerresolutionuserscanselectfromIXtoI.II.
?Internaltemperatureofupperandloweralarmsettings.
FigureIV.SI.VIIIBII0BottomView
TABLEI(BottomView)PinfunctiondescriptionindetailDSI.VIIIBII0
NONamePinFunctionDescription
I.GNDGroundSignal
IIDQDatainput/outputpin.Open-drainsingle-businterfacepins.Whenusedwiththeparasiticpower,theycanstillprovidepowertothedevice.
IIIVDOOptionalVDDpin.Whenworkingontheparasitepower,thispinmustbegrounded.
TheinternalstructureofDSI.VIIIBII0mainlyhasfourcomponents:aVIIV-bitlithographyROM,temperaturesensor,non-volatiletemperaturealarmtriggersTHandTL,configurationregisters.ThetemperaturesensorinDSI.VIIIBII0canmeasurethetemperature.TakingI.II-bitconversionasanexample:AI.VI-bitsignextensionofthebinarycomplementreadingsisprovided;0.0VIIIV℃/LSBaretheformofexpression,inwhichSisasignbit.
FigureV.I.II-bitconversionicon
ThisisaI.II-bitconversionobtainedafteraI.II-bitdatastoredintheI.VIIIBII0twoVIII-bitRAM,thebinaryinthefrontfivearesignbit,ifthemeasuredtemperatureisgreaterthan0,thisVto0,aslongasthewillbemeasuredbythevalueof0.0VIIIVcanbeobtainedattheactualtemperature;ifthetemperatureislessthan0,thisVtoI.,measuredvaluesisnecessaryforanti-pricehikeandthenbyanactualtemperaturecanbeobtainedat0.0VIIIV.Forexample,thenumber+I.IIV℃output0VIID0H,+IIV.0VIIIV℃digitaloutputforthe0I.IXI.H,-IIV.0VIIIV℃digitaloutputFFVIFH,-VV℃digitaloutputFCIX0H.
III.SYSTEMSOFTWAREDESIGNANDACHIEVEMENT
ThesoftwarefunctionofthisdesignisachievedbyAssemblyLanguage.Theprogramhighlightsthefollowingfunctions:displayreal-timedataoftemperature,settemperaturelimitatanytime,thealarmwillringwhenthetemperatureexceedsthenumericalvalueweset.Thecompletionofthesefunctionsisthroughthefollowingsteps:real-timecollectionandtransmissionofdata,dataareprocessedbythecross-SCMsystemintonumericaltypeandcomparedwiththesettings.Tosenddigitaltubedisplayoralarmandsenttothedigitalcontrol.Theprogramflowchartisasfollows:
FigureVI.Flowchart
Theinitializationproceduresandotherpartsoftheproceduresareasfollows:
ORG0000H
LJMPSTART
ORG000IIIH
LJMPTIAOZHENG
BootInitialization:Definetheinitialaddress,gethighonP0PI.PIIPIIIsetI.,intheRVIItosetthevalueofthetemperatureinsidethestoreandwillallowtheEAsetaserialportinterruptwillbeEX0setanallowexternalinterrupt.
__BootInitialization___
START:MOVSP,#VI0H
MOVP0,#0FFH
MOVPI.,#0FFH
MOVPII,#0FFH
MOVPIII,#0FFH
MOVRVII,#II0
SETBEA
SETBEX0
ResetInitialization:ThePIII.IIIportclearedandsetI.,sensortemperaturedatareset
___ResetInitialization___
RSTI.VIIIBII0:SETBPIII.III
NOP
CLRPIII.III
MOVR0,#0VIBH
MOVRI.,#0IIIH
DSRI.:DJNZR0,DSRI.
MOVR0,#VIBH
DJNZRI.,DSRI.
SETBPIII.III
NOP
NOP
NOP
MOVR0,#IIVH
DSRII:JNBPIII.III,DSRIII
DJNZR0,DSRII
LJMPDSRIV
DSRIII:SETB00H
LJMPDSRV
DSRIV:CLR00H
LJMPDSRVII
DSRV:MOVR0,#VIBH
DSRVI:DJNZR0,DSRVI
DSRVII:SETBPIII.III
RET
Astheneedsofmodernindustrialtechnology,thetemperaturemeasurementtechnologyisconstantlyimproving.Thispaperintroducesadigitalthermometerbasedonmicrocomputercontrol,whoseupperandlowerlimitofalarmtemperaturescanbeset.Thedesignsystempossessesstronganti-interference,flexibilityandconvenience,whichcanevenbeusedinharshenvironments.Thisdesignisofhighpracticalsignificance.
References
[I.]Motorola.MotorolaGPSProduct-OncoreUser’sGuide(RivisionV.0)[M].USA:MotorolaInc,II00II.
[II]MIKKOS.WaterhydraulicactuatorsforITERmaintenance
devices[J].FusionEngineeringandDesign,II00III,VIIX(I.-IV):I.IVI.-I.IVV.
[III]LIMGHCHUAP.Modernwaterhydraulics-thenewenergytransmissiontechnologyinfluidpower[J].AppliedEnergy,II00III,VIIVI(I.-III):IIIIIIX-IIIVVI.
[IV]NationalInstrumentsCorporation[M].faceReferenceManual.I.IXIXVIII,IIV-IIIVIII.

版权保护: 本文由 hbsrm.com编辑,转载请保留链接: www.hbsrm.com/lwqt/wxzs/66.html

好棒文