单片机温度控制(29 页)Good is good, but better carries it.精益求精,善益求善。摘 要随着电子产品向智能化和微型化的不断进展,单片机已成为电子产品研制和开发中首选的控制器。为了更好地推广单片机在实际生活和生产中的应用,本文从硬件和软件两个方面介绍了基于 AT89C52 单片机温度控制系统的设计,以实现系统能自主调节温度的功能。该系统的硬件部分由温度采集模块、键盘扫描及按键处理模块、温度显示模块、继电器控制模块组成。其中温度采集模块采纳温度传感器DS18B20来采集当前温度,并对采集的温度信号进行A/D转换以数字信号的方式传送给单片机。键盘扫描及按键处理模块由3×4矩阵键盘、反相驱动器74LS06、显示驱动芯片8279组成,完成扫描键盘,形成键码,并将其送至单片机处理。温度显示模块由显示驱动芯片8279和数码管组成,输入的温度值进行比较,并通过液晶显示器LCD显示出来。继电器控制模块由继电器和升温电炉、降温风扇组成。假如采集温度低于设置温度,系统将通过继电器模块自动控制升温;假如采集温度高于设置温度,系统将通过继电器模块自动控制降温。该系统的软件设计部分由系统主程序流程框图、温度处理子程序流程框图、键盘处理子程序框图组成,其中系统主程序由初始化程序、扫描键盘程序及温度处理子程序组成。温度采集子程序由对温度传感器的初始化和温度处理程序组成。键盘处理子程序由8279芯片的初始化程序及扫描处理程序组成。关键词:单片机AT89C52;温度控制;温度传感器DS18B20;液晶显示器LCD 。ABSTRACTWith the electronic products developing to intelligent and miniaturization, single chip has become the first chosen controller which is used to develop and explore the electronic product. In order to promote single chip applicating in real life and production, the paper will introduce a temperature control system which is based on a kind of single chip AT89C52, and it can achieve the function that the system can regulate the temperature independently.The hardware of the system by the temperature acquisition module, keyboard scan and key processing module, temperature display module, relay control module. Wherein the temperature sensor DS18...