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