I基于单片机的温度控制系统设计与实现——下位机系统基于单片机的温度控制系统设计与实现—下位机系统II摘要温度的测量与控制在工业生产和日常生活中应用广泛。本文介绍了一个基于单片机STC89C52的简单温度控制系统,该系统由上下位机两级组成,上位机采用PC机运行温度监控程序,对温度进行实时监控,同时设定下位机的控制参数,可实现对温度数据的存储管理。下位机由单片机构成温度现场采集与控制终端,负责现场温度的采集与控制。本文着重介绍了下位机系统的设计方案与软硬件实现。下位机系统采用8051单片机组成温度现场测控单元,使用DS18B20数字式温度传感器进行温度测量,温度的实时测量数据通过RS-232上传至上位机,进行实时监视,同时接收上位机的控制指令,通过继电器控制电加热丝的通断,实现对温度的控制。实验表明该系统能够实现对温度的控制,具有一定的控制精度。该系统测温电路简单、连接方便,可用于简单温度控制的场合。关键词:单片机;温度控制;温度传感器;串口通讯IIIBasedonaTemperatureControlSystemDesignandImplementation-ControllerSystemAbstractTheapplicationabouttemperaturemeasurementandcontrolisnormalintheareaofindustryanddailylife.Asimpletemperaturecontrolsystem,basedontheSTC89C52MCU,isintroducedinthispaper,whichincludehostcomputerandslaveone.Thehostone,thatisPC,runstemperaturemonitorsoftwarewhichmonitorsreal-timetemperaturevalue,setsthecontrolparameterstotheslave,andsavethedata.TheslaveistemperaturefieldcollectionandcontrolunitcomposedbyMCU,thedigitaltemperaturesensor,DS18B20,isusedforthetemperaturemeasurement,thereal-timedataistransferredtothehostcomputerbyRS-232fortheonlinemonitoring,thecontrolinstructiondownloadedfromthehostisusedtocontroltemperaturebymeansofheatingwiremake-breakcontrolledbyrelay.Theexperimentshowsthatthesystemcancontrolthetemperaturewiththebettercontrolprecise.Withthesimplicityofthetemperaturemeasurementcircuitandtheconvenientconnectionprocedure,thissystemmaybeadaptableforthesituationsneededsimpletemperaturecontrol.Keywords:MCU;Temperaturecontrol;Temperaturesensor;Serialcommunication基于单片机的温度控制系统设计与实现—下位机系统IV目录1绪论...................................................................................................................................11.1温度控制系统的发展现状.........................................................................................11.2课题的内容及要求.....................................................................................................31.3论文的内容及安排.....................................................................................................42温度控制系统总体方案设计...........................................................................................52.1系统总体方案设计.....................................................................................................52.2硬件总体方案设计.....................................................................................................52.3软件总体方案设计.....................................................................................................73温度控制系统硬件系统设计...........................................................................................83.1单片机最小系统设计.................................................................................................83.2测温电路设计...........................................................................................................103.2.1DS18B20的介绍................................................................................................103.2.2测温电路设计....................................................................................................133.3控温电路设计...........................................................................................................143.4电平转换及串口通信电路.......................................................................................153.4.1电平转化电路....................................................................................................163.4.2串口通信电路....................................................................................................164温度控制系统的软件方案设计.....................................................................................194.1初始化子程序设计...................................................................................................194.2DS18B20测温子程序设计.......................................................................................194.3串口通信子程序设计...............................................................................................224.4控制部分子程序设计...............................................................................................245系统调试.........................................................................................................................255.1硬件部分调试...........................................................................................................255.2软件部分调试...........................................................................................................265.3系统联调...................................................................................................................27结论.....................................................................................................................................29V社会经济效益分析.............................................................................................................30参考文献.............................................................................................................................31致谢.....................................................................................................................................33附录Ⅰ电路图..........