基于51单片机的粮仓温湿度检测系统毕业设计 下载本文

基于51单片机的粮仓温湿度检测系统

[摘要]粮仓温度湿度监测控制系统是基于STC12C52A60S2的数据采集、对比、控制的系统。以STC12C52A60S2单片机为控制器,对温度传感器DS18B20传送的数字量信号和对湿度传感器HR202传送的模拟量信号进行采集和处理,当前值和设定温度上限值进行对比,进而执行控制作用,通过对继电器的控制进而控制设备的启停,对粮仓温度湿度进行调节,使其维持在适当范围,维护粮仓正常运行。 [关键词] 单片机、温湿度、检测、控制

Abstract:The granary’s temperature and humidity control and detect system

is based on the micro control unit of STC12C5A60S2,the system is used for date acquisition,comparison,and control.In this system,STC12C5A60S2 is the controller,the controller is designed to deal with temperature and humidity signal from the temperature sensor and humidity sensor.Then compare these data with limits the value of temperature and humidity.If the date is out of limits,then the controller send a control signal to warn people,besides,the controller will make the fan running to make the temperature and humidity lower.In this way,the granary can be working at usual status.

Key words: MCU、temperature and humidity、control

目录

第一章 绪论 ................................................................ 1

1.2相关领域国内外应用的现状及发展趋势 ................................... 1 1.3 粮仓温湿度检测控制系统原理 .......................................... 2 1.4 本章小结 ............................................................. 2 第二章:系统分析、设计要求及模块选择 ......................................... 3

2.1 设计要求 ............................................................ 3 2.2 单片机型号的选择 .................................................... 3

2.21 采用STC89C52单片机 ............................................ 3 2.22 采用STC12C5A60S2单片机 ........................................ 3 2.3 显示系统模块的选择 .................................................. 3

2.31采用LED数码管显示 .............................................. 3 2.32采用1602液晶显示 ............................................... 3 2.4 测温模块的选择 ...................................................... 4

2.41 采用模拟量温度传感器 ........................................... 4 2.42 采用数字量温度传感器 ......................................... 4 2.5 测湿模块的选择 ...................................................... 4 2.6 控制模块的选择 ...................................................... 4 2.7 通讯模块的选择 ...................................................... 4 2.8本章小结 ............................................................. 4 第三章 系统总体方案及硬件电路模块设计 ...................................... 5

3.1 系统总体设计思路: .................................................. 5 3.2 系统硬件设计 ........................................................ 5

3.2.1 单片机最小系统 ................................................ 5 3.2.2 温度信号采样电路模块 .......................................... 9 3.2.3 湿度采样电路模块 ............................................. 12 3.3 串口模块 ........................................................... 14 3.4显示模块 ............................................................ 15 3.5 控制模块 ........................................................... 16 3.6 继电器模块 ......................................................... 17 3.7 本章小结 .......................................................... 18 第四章 系统的软件设计 ..................................................... 19

4.1 流程图设计 ........................................................ 19

4.1.1系统总体流程图 ................................................ 19 4.1.2温度检测流程图 ................................................ 19 4.1.3湿度检测流程 .................................................. 20 4.2系统的程序设计 ...................................................... 20

4.2.1 DS18B20测温程序 ............................................. 20 4.2.2 A/D转换程序 ................................................ 25

4.2.3 1602显示程序 ................................................ 26 4.3 本章小结 ........................................................... 29 第五章 硬件调试部分 ....................................................... 30 结束语 ..................................................................... 31 参考文献.................................................................... 32