河南理工大学毕业设计(论文)说明书
摘 要
环境温度对工业、农业、商业和人们的日常生活都有很大的影响,而温度的测量也就成为人们生产生活中一项必不可少的工作。随着单片机技术的不断发展,单片机在日用电子产品中的应用越来越广泛,温度传感器DS18B20具有线性优良、性能稳定、灵敏度高、抗干扰能力强、使用方便等优点,广泛应用于冰箱、空调器、粮仓等日常生活中温度的测量和控制。
本设计所介绍的数字温度计使用单片机AT89s52单片机,测温传感器使用DS18B20,用4位共阴极LED数码管以动态方式实现温度显示,分时轮流通电,从而大大简化了硬件线路,同时,采用串口通信方式可大大简化硬件电路和软件程序的设计,节省了I/O口。DS18B20数字温度传感器是单总线器件与51单片机组成的测温系统,具有线路简单、体积小等特点,而且在一根通信线上,可以挂接多个DS18B20,因此可以构成多点温度测控系统。 关键词:单片机;多点检测;串口通信
I
河南理工大学毕业设计(论文)说明书
Abstract
Environmental temperature to industry, agriculture, commerce, and people's daily life has a lot of influence, and the measurement of the temperature will become an indispensable people production and life of the work. Along with the development of the single chip microcomputer technology, microcomputer in the daily electronic products is more and more extensive application, the temperature sensor DS18B20 have good linear, stable performance, high sensitivity, anti-interference ability strong, easy to use, widely used in the refrigerator, air conditioner, granaries, etc in daily life temperature measurement and control.
The design of the digital thermometer introduced use single chip computer 89 s52 microcontroller, temperature sensor DS18B20 use, with a total of 4 cathode tube LED digital display to realize dynamic way temperature, in turn time-sharing electricity, which greatly simplified the hardware circuit, and at the same time, the serial interface communication mode can greatly simplified the hardware circuit and software program design, save the I/O port. Digital temperature sensor DS18B20 is the single bus devices and 51 SCM composition, temperature measurement system, with simple line, little volume features, but at a communications line, can be articulated multiple DS18B20, so can form multi-point temperature measurement and control system.
Key Words: Single Chip Microcomputer; Multi-point detection; Serial commun-
-ication
II
河南理工大学毕业设计(论文)说明书
目 录
1 绪论............................................................................................................................ 1
1.1 前言................................................................................................................. 1 1.2 研究背景......................................................................................................... 1 1.3 研究意义......................................................................................................... 1 1.4 国内外研究现状............................................................................................. 2 1.5 研究内容......................................................................................................... 2 2 系统方案论证............................................................................................................ 3
2.1 传感器部分方案论证..................................................................................... 3 2.2 控制部分方案论证......................................................................................... 4 2.3 系统整体方案................................................................................................. 4 3 硬件电路设计............................................................................................................ 6
3.1 控制模块设计................................................................................................. 6
3.1.1 AT89S52单片机在系统中的作用 ....................................................... 6 3.1.2 按键电路设计...................................................................................... 9 3.2 测温模块电路设计....................................................................................... 11
3.2.1 DS18B20简介 .................................................................................... 11 3.2.2 DS18B20在系统中的应用 ................................................................ 13 3.3 电平转换模块设计....................................................................................... 14
3.3.1 MAX232电平转换芯片简介 ............................................................ 14 3.3.2 MAX232在本系统中的应用 ............................................................ 15 3.4 报警模块电路设计....................................................................................... 16 3.5 电源模块电路设计....................................................................................... 17 4 软件设计 ................................................................................................................. 19
4.1 温度转换模块程序设计............................................................................... 19 4.2 串口通信模块程序设计............................................................................... 20
4.2.1 串口通信方式设置............................................................................ 20 4.2.2 波特率设置........................................................................................ 22
III