1、外文原文:DesignoftheTemperatureControlSystemBasedonAT89C51ABSTRACTTheprincipleandfunctionsofthetemperaturecontrolsystembasedonmicrocontrollerAT89C51arestudied,andthetemperaturemeasurementunitconsistsofthe1-WirebusdigitaltemperaturesensorDS18B20.Thesystemcanbeexpectedtodetectthepresettemperature,displayt
2、imeandsavemonitoringdata.Analarmwillbegivenbysystemifthetemperatureexceedstheupperandlowerlimitvalueofthetemperaturewhichcanbesetdiscretionarilyandthenautomaticcontrolisachieved,thusthetemperatureisachievedmonitoringintelligentlywithinacertainrange.Basingonprincipleofthesystem,itiseasytomakeavariety
3、ofothernon-linearcontrolsystemssolongasthesoftwaredesignisreasonablychanged.Thesystemhasbeenprovedtobeaccurate,reliableandsatisfiedthroughfieldpractice.KEYWORDS:AT89C51;microcontroller;DS18B20;temperature1INTRODUCTIONTemperatureisaveryimportantparameterinhumanlife.Inthemodernsociety,temperaturecontr
4、ol(TC)isnotonlyusedinindustrialproduction,butalsowidelyusedinotherfields.Withtheimprovementofthelifequality,wecanfindtheTCapplianceinhotels,factoriesandhomeaswell.AndthetrendthatTCwillbetterservethewholesociety,soitisofgreatsignificancetomeasureandcontrolthetemperature.BasedontheAT89C51andtemperatur
5、esensorDS18B20,thissystemcontrolstheconditiontemperatureintelligently.Thetemperaturecanbesetdiscretionarilywithinacertainrange.ThesystemcanshowthetimeonLCD,andsavemonitoringdata;andautomaticallycontrolthetemperaturewhentheconditiontemperatureexceedstheupperandlowerlimitvalue.Bydoingsoitistokeepthete
6、mperatureunchanged.Thesystemisofhighanti-jamming,highcontrolprecisionandflexibledesign;italsofitstheruggedenvironment.Itismainlyusedinpeopleslifetoimprovethequalityoftheworkandlife.Itisalsoversatile,sothatitcanbeconvenienttoextendtheuseofthesystem.Sothedesignisofprofoundimportance.Thegeneraldesign,h
7、ardwaredesignandsoftwaredesignofthesystemarecovered.1.1Introduction The8-bitAT89C51CHMOSmicrocontrollersaredesignedtohandlehigh-speedcalculationsandfastinput/outputoperations.MCS51microcontrollersaretypicallyusedforhigh-speedeventcontrolsystems.Commercialapplicationsincludemodems,motor-controlsystem
8、s,printers,photocopiers,airconditionercontrolsystems,diskdrives,andmedicalinstruments.TheautomotiveindustryuseMCS51microcontrollersinengine-controlsystems,airbags,suspensionsystems,andantilockbrakingsystems(ABS).TheAT89C51isespeciallywellsuitedtoapplicationsthatbenefitfromitsprocessingspeedandenhanc
9、edon-chipperipheralfunctionsset,suchasautomotivepower-traincontrol,vehicledynamicsuspension,antilockbraking,andstabilitycontrolapplications.Becauseofthesecriticalapplications,themarketrequiresareliablecost-effectivecontrollerwithalowinterruptlatencyresponse,abilitytoservicethehighnumberoftimeandeven
10、tdrivenintegratedperipheralsneededinrealtimeapplications,andaCPUwithaboveaverageprocessingpowerinasinglepackage.Thefinancialandlegalriskofhavingdevicesthatoperateunpredictablyisveryhigh.Onceinthemarket,particularlyinmissioncriticalapplicationssuchasanautopilotoranti-lockbrakingsystem,mistakesarefina
11、nciallyprohibitive.Redesigncostscanrunashighasa$500K,muchmoreifthefixmeans2backannotatingitacrossaproductfamilythatsharethesamecoreand/orperipheraldesignflaw.Inaddition,fieldreplacementsofcomponentsisextremelyexpensive,asthedevicesaretypicallysealedinmoduleswithatotalvalueseveraltimesthatofthecompon
12、ent.Tomitigatetheseproblems,itisessentialthatcomprehensivetestingofthecontrollersbecarriedoutatboththecomponentlevelandsystemlevelunderworstcaseenvironmentalandvoltageconditions.Thiscompleteandthoroughvalidationnecessitatesnotonlyawell-definedprocessbutalsoaproperenvironmentandtoolstofacilitateandex
13、ecutethemissionsuccessfully.IntelChandlerPlatformEngineeringgroupprovidespostsiliconsystemvalidation(SV)ofvariousmicro-controllersandprocessors.Thesystemvalidationprocesscanbebrokenintothreemajorparts.Thetypeofthedeviceanditsapplicationrequirementsdeterminewhichtypesoftestingareperformedonthedevice.
14、1.2TheAT89C51providesthefollowingstandardfeatures4KbytesofFlash,128bytesofRAM,32I/Olines,two16-bittimer/counters,afivevectortwo-levelinterruptarchitecture,afulldupleser-ialport,on-chiposcillatorandclockcircuitry.Inaddition,theAT89C51isdesignedwithstaticlogicforoperationdowntozerofrequencyandsupports
15、twosoftwareselectablepowersavingmodes.TheIdleModestopstheCPUwhileallowingtheRAM,timer/counters,serialportandinterruptsys-temtocontinuefunctioning.ThePower-downModesaves theRAMcontentsbutfreezestheoscillatordisablingallotherchipfunctionsuntilthenexthardwarereset.1.3PinDescriptionVCCSupplyvoltage.GNDG
16、round.Port0:Port0isan8-bitopen-drainbi-directionalI/Oport.Asanoutputport,eachpincansinkeightTTLinputs.When1sarewrittentoport0pins,thepinscanbeusedashighimpedanceinputs.Port0mayalsobeconfiguredtobethemultiplexedloworderaddress/databusduringaccessestoexternalprogramanddatamemory.InthismodeP0hasinterna
17、lpullups.Port0alsoreceivesthecodebytesduringFlashprogramming,andoutputsthecodebytesduringprogramverification.Externalpullupsarerequiredduringprogramverification.Port1:Port1isan8-bitbi-directionalI/Oportwithinternalpullups.ThePort1outputbufferscansink/so-urcefourTTLinputs.When1sarewrittentoPort1pinst
18、heyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port1pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpullups.Port1alsoreceivesthelow-orderaddressbytesduringFlashprogrammingandverification.Port2:Port2isan8-bitbi-directionalI/Oportwithinternalpullups.TheP
19、ort2outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort2pinstheyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port2pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpullups.Port2emitsthehigh-orderaddressbyteduringfetchesfromexternalprogrammemor
20、yandduringaccessestoPort2pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpullups.Port2emitsthehigh-orderaddressbyteduringfetchesfromexternalprogrammemoryandduringaccessestoexternaldatamemorythatuse16-bitaddresses(MOVXDPTR).Inthisapplication,itusesstronginternalpull-upswh
21、enemitting1s.Duringaccessestoexternaldatamemorythatuse8-bitaddresses(MOVXRI),Port2emitsthecontentsoftheP2SpecialFunctionRegister.Port2alsoreceivesthehigh-orderaddressbitsandsomecontrolsignalsdurinFlashprogrammingandverification.Port3:Port3isan8-bitbi-directionalI/Oportwithinternalpullups.ThePort3out
22、putbufferscansink/sou-rcefourTTLinputs.When1sarewrittentoPort3pinstheyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port3pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseofthepullups.Port3alsoservesthefunctionsofvariousspecialfeaturesoftheAT89C51aslistedbelow:RST:Rese
23、tinput.Ahighonthispinfortwomachinecycleswhiletheoscillatorisrunningresetsthedevice.ALE/PROG:AddressLatchEnableoutputpulseforlatchingthelowbyteoftheaddressduringaccessestoexternalmemory.Thispinisalsotheprogrampulseinput(PROG)duringFlashprogramming.InnormaloperationALEisemittedataconstantrateof1/6theo
24、scillatorfrequency,andmaybeusedforexternaltimingorclockingpurposes.Note,however,thatoneALEpulseisskippedduri-ngeachaccesstoexternalDataMemory.Ifdesired,ALEoperationcanbedisabledbysettingbit0ofSFRlocation8EH.Withthebitset,ALEisactiveonlyduringaMOVXorMOVCinstruction.Otherwise,thepinisweaklypulledhigh.
25、SettingtheALE-disablebithasnoeffectifthemicrocontrollerisinexternalexecutionmode.PSEN:ProgramStoreEnableisthereadstrobetoexternalprogrammemory.WhentheAT89C51isexecutingcodefromexternalprogrammemory,PSENisactivatedtwiceeachmachinecycle,exceptthattwoPSENactivationsareskippedduringeachaccesstoexternald
26、atamemory.EA/VPP:ExternalAccessEnable.EAmustbestrappedtoGNDinordertoenablethedevicetofetchcodefromexternalprogrammemorylocationsstartingat0000HuptoFFFFH.Note,however,thatiflockbit1isprogrammed,EAwillbeinternallylatchedonreset.EAshouldbestrappedtoVCCforinternalprogramexecutions.Thispinalsreceivesthe1
27、2-voltprogrammingenablevoltage(VPP)duringFlashprogramming,forpartsthatrequire12-voltVPP.XTAL1:Inputtotheinvertingoscillatoramplifierandinputtotheinternalclockoperatingcircuit.XTAL2:Outputfromtheinvertingoscillatoramplifier.OscillatorCharacteristicsXTAL1andXTAL2aretheinputandoutput,respectively,ofani
28、nvertingamplifierwhichcanbeconfiguredforuseasanon-chiposcillator,asshowninFigure1.Eitheraquartzcrystalorceramicresonatormaybeused.Todrivethedevicefromanexternalclocksource,XTAL2shouldbeleftunconnectedwhileXTAL1isdrivenasshowninFigure2.Therearenorequirementsonthedutycycleoftheexternalclocksignal,sinc
29、etheinputtotheinternalclockingcircuitryisthroughadivide-by-twoflip-flop,butminimumandmaximumvoltagehighandlowtimespecificationsmustbeobserved.IdleModeInidlemode,theCPUputsitselftosleepwhilealltheonchipperipheralsremainactive.Themodeisinvokedbysoftware.Thecontentoftheon-chipRAMandallthespecialfunctio
30、nsregistersremainunchangedduringthismode.Theidlemodecanbeterminatedbyanyenabledinterruptorbyahardwarereset.Itshouldbenotedthatwhenidleisterminatedbyahardwarereset,thedevicenormallyresumesprogramexecution,fromwhereitleftoff,uptotwomachinecyclesbeforetheinternalresetalgorithmtakescontrol.On-chiphardwa
31、reinhibitsaccesstointernalRAMinthisevent,butaccesstotheportpinsisnotinhibited.ToeliminatethepossibilityofanunexpectedwritetoaportpinwhenIdleisterminatedbyreset,theinstructionfollowingtheonethatinvokesIdleshouldnotbeonethatwritestoaportpinortoexternalmemory.Power-downModeInthepower-downmode,theoscill
32、atorisstopped,andtheinstructionthatinvokespower-downisthelastinstructionexecuted.Theon-chipRAMandSpecialFunctionRegistersretaintheirvaluesuntilthepower-downmodeisterminated.Theonlyexitfrompower-downisahardwarereset.ResetredefinestheSFRSbutdoesnotchangetheon-chipRAM.Theresetshouldnotbeactivatedbefore
33、VCCisrestoredtoitsnormaloperatinglevelandmustbeheldactivelongenoughtoallowtheoscillatortorestartandstabilize.TheAT89C51codememoryarrayisprogrammedbyte-bybyteineitherprogrammingmode.Toprogramanynonblankbyteintheon-chipFlashMemory,theentirememorymustbeerasedusingtheChipEraseMode.2ProgrammingAlgorithmB
34、eforeprogrammingtheAT89C51,theaddress,dataandcontrolsignalsshouldbesetupaccordingtotheFlashprogrammingmodetableandFigure3andFigure4.ToprogramtheAT89C51,takethefollowingsteps.1.Inputthedesiredmemorylocationontheaddresslines.2.Inputtheappropriatedatabyteonthedatalines.3.Activatethecorrectcombinationof
35、controlsignals.4.RaiseEA/VPPto12Vforthehigh-voltageprogrammingmode.5.PulseALE/PROGoncetoprogramabyteintheFlasharrayorthelockbits.Thebyte-writecycleisself-timedandtypicallytakesno.翻译:温度控制系统设计摘要研究了基于AT89C51单片机温度控制系统原理和功效,温度测量单元由单总线数字温度传感器DS18B20组成。该系统可进行温度设定,时间显示和保留监测数据。假如温度超出任意设置上限和下限值,系统将报警并能够和自动控制实
36、现,从而达成温度监测智能一定范围内。基于系统原理,很轻易使其它多种非线性控制系统,只要软件设计合理改变。该系统已被证实是正确,可靠和满意经过现场实践。关键词:单片机;温度;温度1导言温度是在人类生活中很关键参数。在现代社会中,温度控制(TC)不仅用于工业生产,还广泛应用于其它领域。伴随生活质量提升,我们能够发觉在酒店,工厂和家庭,和比赛设备。而比赛趋势将愈加好地服务于整个社会,所以它含有十分关键意义测量和控制温度。在AT89C51单片机和温度传感器DS18B20基础上,系统环境温度智能控制。温度可设定在一定范围内动任意。该系统能够显示在液晶显示器时间,并保留监测数据,并自动地控制温度,当环境温
37、度超出上限和下限值。这么做是为了保持温度不变。该系统含有很高抗干扰能力,控制精度高,灵活设计,它也很适合这个恶劣环境。它关键应用于大家生活,改善工作和生活质量。这也是通用,所以它能够方便地扩大使用该系统。所以,设计含有深刻关键性。通常设计,硬件设计和软件系统设计全部包含在内。1.1介绍8位AT89C51CHMOS工艺单片机被设计用于处理高速计算和快速输入/输出。MCS51单片机经典应用是高速事件控制系统。商业应用包含调制解调器,电动机控制系统,打印机,影印机,空调控制系统,磁盘驱动器和医疗设备。汽车工业把MCS51单片机用于发动机控制系统,悬挂系统和反锁制动系统。AT89C51尤其很好适适用于
38、得益于它处理速度和增强型片上外围功效集,诸如:汽车动力控制,车辆动态悬挂,反锁制动和稳定性控制应用。因为这些决定性应用,市场需要一个可靠含有低干扰潜伏响应费用-效能控制器,服务大量时间和事件驱动在实时应用需要集成外围能力,含有在单一程序包中高出平均处理功率中央处理器。拥有操作不可估计设备经济和法律风险是很高。一旦进入市场,尤其任务决定性应用诸如自动驾驶仪或反锁制动系统,错误将是财力上所严禁。重新设计费用能够高达500K美元,假如产品族享受一样内核或外围设计缺点话,费用会更高。另外,部件替换品领域是极其昂贵,因为设备要用来把模块经典地焊接成一个总体价值比各个部件高几倍。为了缓解这些问题,在最坏环
39、境和电压条件下对这些单片机进行不管在部件等级还是系统等级上综合测试是必需。IntelChandler平台工程组提供了多种单片机和处理器系统验证。这种系统验证处理能够被分解为三个关键部分。系统类型和应用需求决定了能够在设备上实施测试类型。1.2AT89C51提供以下标准功效4k字节FLASH闪速存放器,128字节内部RAM,32个I/O口线,2个16位定时/计数器,一个5向量两级中止结构,一个全双工串行通信口,片内振荡器立即钟电路。同时,AT89C51降至0Hz静态逻辑操作,并支持两种可选节电工作模式。空闲方法体制CPU工作,但许可RAM,定时/计数器,串行通信口及中止系统继续工作。掉电方法保留
40、RAM中内容,但振荡器体制工作并严禁其它全部不见工作直到下一个硬件复位。1.3引脚功效说明Vcc:电源电压GND:地P0口:P0口是一组8位漏极开路型双向I/O口,也即地址/数据总线复用。作为输出口用时,每位能吸收电流方法驱动8个TTL逻辑门电路,对端口写“1”可作为高阻抗输入端用。在访问外部数据存放器或程序存放器时,这组口线分时转换地址(低8位)和数据总线复用,在访问期间激活内部上拉电阻。在Flash编程时,P0口接收指令字节,而在程序校验时,输出指令字节,校验时,要求外接上拉电阻。P1口:P1是一个带内部上拉电阻8位双向I/O口,P1输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。
41、对端口写“1”,经过内部上拉电阻把端口拉到高电平,此时可作输入口。作为输入口使用时,因为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(IIL)。Flash编程和程序校验期间,P1接收低8位地址。P2口:P2是一个带有内部上拉电阻8位双向I/O口,P2输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。对端口写“1”,经过内部上拉电阻把端口拉到高电平,此时可作输入口。作为输入口使用时,因为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(IIL)。在访问外部程序存放器或16位四肢外部数据存放器(比如实施MOVXDPTR指令)时,P2口送出高8位地址数据,在访问8位地址外部
42、数据存放器(比如实施MOVXRI指令)时,P2口线上内容(也即特殊功效寄存器(SFR)区中R2寄存器内容),在整个访问期间不改变。Flash编程和程序校验时,P2也接收高位地址和其它控制信号。P3口:P3是一个带有内部上拉电阻8位双向I/O口,P3输出缓冲级可驱动(吸收或输出电流)4个TTL逻辑门电路。对端口写“1”,经过内部上拉电阻把端口拉到高电平,此时可作输入口。作为输入口使用时,因为内部存在上拉电阻,某个引脚被外部信号拉低时会输出一个电流(IIL)。P3口还接收部分用于Flash闪速存放器编程和程序校验控制信号。RST:复位输入。当振荡器工作时,RST引脚出现两个机器周期以上高电平将使单片机复位。ALE/PROG:当访问外部程序存放器或数据存放器时,ALE(地址锁存许可)输出脉冲用于锁存地址低8位字节。即使不访问外部存放器,ALE仍以时钟振荡频率1/6输出
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100