陕西理工学院毕业设计
题 目 基于STM32的室内温度控制系统_______ 学生姓名 李枝玲 学号 1213014137_____
所在学院 陕西理工学院____________
专业班级 电子信息工程________________
指导教师 梁芳____________________ 完成地点 物理与电信工程实验室__________
2016 年 5 月 29 日
陕西理工学院毕业设计
基于STM32的室内温度控制系统
李枝玲
(陕西理工学院 物理与电信工程学院 电子信息工程专业 电子1205班,陕西汉中723000)
指导教师:梁芳
[摘要] 本设计是以STM32单片机为核心的温度控制系统。采用DS18B20温度传感器实现对温度的采集,并用
TFT液晶屏对温度进行显示。通过对元器件的选择,设计系统的硬件电路,从而设计相关应用程序,制作实物,实现温度采集、显示、控制等功能。结果表明,所设计的温度控制系统基本能够完成所需功能,并且具有测量精准高、实时性好、使用方便等特点。
[关键词] 温度控制; DS18B20;STM32单片机
Indoor temperature control system based on STM32
Zhiling Li
(Electronic information engineering, School of physics and telecommunication engineering,
Shaanxi University of Technology, Hanzhoung 723000, Shaanxi, 1205)
Tutor: Fang Liang
Abstract This design is based on STM32 microcontroller as the core of the temperature control system.Using DS18B20 temperature sensor to achieve the temperature of the collection, the use of TFT LCD screen to display the temperature. the hardware circuit of the system is designed through the selection of components; So as to design the related application, make the object, realize the function of temperature acquisition, display, control and other functions.The results show that the designed temperature control system can basically complete the required functions, and has the characteristics of high precision, good real-time performance, easy to use, and so on.
Keywords temperature control;DS18B20;STM32 single chip microcompute
I
陕西理工学院毕业设计
目录
绪论 ...................................................................................................................... 1 1 系统总体设计 ................................................................................................ 2
1.1系统功能要求 ......................................................................................... 2 1.2系统方案论证 ......................................................................................... 2 1.3系统设计框图 ......................................................................................... 2 1.4 具体控制选择 ........................................................................................ 2 1.4.1 控制器选择 .................................................................................. 2 1.4.2 温度传感器 .................................................................................. 3
2 硬件设计 ......................................................................................................... 4
2.1硬件构成 ................................................................................................. 4 2.2 控制模块 ................................................................................................ 4 2.2.1 STM32简介 ................................................................................... 4 2.2.2 STM32的主要优点 ....................................................................... 5 2.2.3 STM32开发板 ............................................................................... 6 2.3 最小系统设计 ........................................................................................ 7 2.4 温度采集模块 ........................................................................................ 8 2.4.1 DS18B20的介绍 ........................................................................... 8 2.4.2 DS18B20工作原理介绍 ............................................................... 8 2.4.3 DS18B20使用中的注意事项 ....................................................... 9 2.4.4 DS18B20与STM32单片机的连接电路 ....................................... 9
II
陕西理工学院毕业设计
2.5 显示模块 .............................................................................................. 10 2.5.1 TFTLCD液晶显示简介 ............................................................... 10 2.5.2 ALIENTEK 2.8液晶简介 ........................................................... 10 2.6 按键模块 .............................................................................................. 11 2.7 电源模块 .............................................................................................. 12 2.8 风机模块 .............................................................................................. 12
3 系统软件设计 .............................................................................................. 13
3.1 主程序 .................................................................................................. 13 3.2 温度采集子程序 .................................................................................. 14 3.4 按键子程序 .......................................................................................... 16
4 系统调试 ....................................................................................................... 17
4.1 硬件调试 .............................................................................................. 17 4.2 软件调试 .............................................................................................. 17 4.3 联合调试 .............................................................................................. 17 4.4 故障分析 .............................................................................................. 17
5 总结与展望 ................................................................................................... 19
5.1 总结 ....................................................................................................... 19 5.2 展望 ....................................................................................................... 19
致谢 .................................................................................................................... 20 参考文献 ........................................................................................................... 21 附录A 外文及翻译 ....................................................................................... 22
III
陕西理工学院毕业设计
原文 .............................................................................................................. 22 译文 .............................................................................................................. 29
附录B 系统电路图 ......................................................................................... 35 附录C 实物图 .................................................................................................. 36 附录D 程序清单 ............................................................................................. 37
IV