摘要基于DS18B20的温度传感系统设计方案,运用Atmel公司AVR系列具有高性能单片机ATmega16作为温度测量的控制核心,结合双线的温度传感器DS18B20实现温度的采集、显示和串口传输。本温度传感系统的硬件设计主要包括单片机ATmega16外围电路设计,温度传感器DS18B20的外围电路设计以及供电,显示等辅助功能电路设计。所用的开发板上主控芯片是ATmega16单片机,开发板的开发资源丰富,足够满足本温度采集系统的硬件需求。本系统的软件由两大部分组成:1、单片机控制软件单片机控制程序主要包括温度传感器DS18B20的驱动程序、单片机定时器0定时中断程序以及单片机UART串口通信和数据命令解析程序。最终可以实现环境温度的实时采集和显示、定时通过串口发送温度数据以及得到PC端获取温度指令后发送温度数据的功能。2、PC机部分上位机软件上位机软件主要能实现温度数据的串口收发,以及用户通过鼠标点击查询按钮后获取当前环境温度数据的功能。预期结果本系统预期要实现环境温度的实时采集显示和定时串口收发以及按照用户需求串口收发的基本功能,是一项有技术含量有意义的单片机作品。关键词DS18B20,PC机,AVR单片机,串口,温度测量ContentabstractTemperaturesensingsystembasedonchipDS18B20Atmelcompanydesign,usewithhighperformancemicroprocessorATmega16AVRseriesascontrolcoreofmeasurementtemperature,combiningwiththetemperaturesensorDS18B20doublerealizethecollectionoftemperature,displayandserialtransmission.ThistemperaturesensingsystemhardwaredesignincludesmicrocontrollerATmega16peripheralcircuitdesign,thetemperaturesensorDS18B20peripheralcircuitdesignandsupply,displaytheauxiliaryfunctioncircuitdesign.ThedevelopmentboardusedATmega16microcontroller,masterchipisthedevelopmentofdevelopmentboardrichresources,enoughtosatisfythistemperaturecollectionsystemhardwarerequirements.Thesoftwareofthissystemconsistsoftwomaincomponents:1andsingle-chipmicrocomputercontrolsoftwareSCMcontrolproceduremainlyincludetemperaturesensorDS18B20driver,digitaltubereal-timedisplayprocedures,microcontrollertimer0timinginterruptionprogramandsingle-chipmicrocomputerUARTserialcommunicationanddatacommandsparsingprogram.Eventuallycanrealizereal-timedataacquisitionandtheenvironmentaltemperaturedisplay,regularlysendtemperaturedatathroughaserialportandgetthePCgaintemperatureinstructionssentafterthefunctionoftemperaturedata.2,PCpartsPCsoftwarePCsoftwaremaincanrealizetemperaturedataofserialtransceiver,andusersthroughthemousetoclickinquiresthebuttongetsthecurrentenvironmentafterthefunctionoftemperaturedata.ExpectedresultsThissystemisexpectedtoachieveenvironmentaltemperaturecollectreal-timedisplayandtimingserialtransceiverandserialportaccordingtouserrequirements,thebasicfunctionofreceivingisaskilledmeaningfulmicrocontrollerworks.Keywords:DS18B20,PC,AVRmicrocontroller,serialports,temperaturemeasurement目录摘要-------------------------------------------------------------------------------ⅠContentabstract---------------------------------------------------------------Ⅱ绪论------------------------------------------------------------------1、设计的目的和意义------------------------------------------------------3温度传感器-----------------------------------------------------温度传感器的发展---------------------------------------------------------1.3论文研究的内容--------------------------------------------------------------第二章系统总体的设计---------------------------------------------------------2.1系统总体结构框图-----------------------------------------------------------2.2系统设计硬件的确定--------------------------------------------------------2.2.1单片机的选择---------------------------------------------------------2.2.2温度传感器的选型----------------------------------------------------2.2.3串行通信的选择-------------------------------------------------------第三章系统的硬件设计-------------------------------------------------------3.1系统开发板------------------------------------------------------------3.2ATmega16AVR单片机------------------------------------------------------3.3DS18B20温度传感-------------------------------------------------------3.4UART串行通信设备---------------------------------------第四章系统的编制与实现-----------------------------------------------------4.1主程序设计-----------------------------------------------------------------4.2DS18B20模块程序设计---------------------------------------------------4.2.1DS18B20工作的过程---------------------------------------------------4.2.2DS18B20工作的时序----------------------------------------------------4.2.3DS18B20温度程序代码-------------------------------------------------4.2.4温度采集流程图------------------------------------------------------------4.3显示模块设计---------------------------------------------------------------4.3.1C++4.4串口通信设计----------------------------------------------------------------4.4.1单片机端口通信程序设计------------------------------------------------4.4.2PC端通信程序设计--------------------------------------------------------4.5现场实测温度显示-----------------------------------------------------------第五章结论------------------------------------------------------------------------5.1总结----------------------------------------------------------------------------5.2系统实物图--------------------------------------------------------------------5.3展望-----------------------------------------------------------------------------参考文献---------------------------------------------------------------------------个人简历---------------------------------------------------------------------------致谢----------------------------------------------------------------------------------附录-----------------------------------------------------------------------------------第一章绪论伴随着科学技术的进步和经济的不断发展,温度控制已经成为人类生产生活中不可或缺的一部分。诸如自动化工业,环境监测与保护,生产安全监控,都里不来温度测量这个最为重要的环境基础性参数。而如何实现测量的精确性,稳定性,可操作性,低投入并且高效,是新一