摘要
温度是一种最基本的环境参数,人们生活与环境温度息息相关,日常生活以及工业生产过程中都时常需要测量温度,因此研究温度测量的方法和控制有重要的意义。
本文介绍了一种以单片机为主要控制器件,以 DS18B20为温度传感器的一台数字显示温度计。它主要包括硬件电路的设计和系统程序的设计,硬件电路主要包括主控制器,测温控制电路和显示电路等。主控制器采用单片机AT89S51,温度传感器则采用美国DALLAS半导体公司成产的DS18B20,显示电路采用8位共阴极LED数码管,ULN2803A为驱动的动态扫描直读显示。测温控制电路由温度计传感器和预置温度值比较报警电路组成。当实际测量温度值大于预置温度值时,发出报警信号。系统程序主要包括主程序,测温子程序和显示子程序等。DS18B20新型单总线数字温度传感器是DALLAS公司生产的单线数字温度传感器,集温度测量和A/D转换于一体。直接输出数字量,具有接口简单,精度高,抗干扰能力强,工作稳定可靠等特点。
由于采用了智能温度传感器DS18B20作为检测元件,与传统的温度计相比,本数字温度计减少了外部的硬件电路,具有低成本和易使用的特点。DS18B20温度计还可以在高温报警,远距离多点测温控制等方面进行应用开发,具有很好的发展前景。
关键词:单片机 温度检测 AT89S51 DS18B20 显示电路
Abstract
Temperature is one of the most basic environmental parameters, and environmental temperature is closely related to people's life, daily life and industrial production process are often need to measure temperature, therefore the research on the temperature measurement and control has important significance.
This paper introduces a microcontroller as the main control device based on DS18B20temperature sensor, a digital display thermometer. It mainly includes the hardware circuit design and system design procedures, the hardware electric circuit mainly comprises a main controller, temperature control circuit and display circuit. The main controller chip AT89S51, the temperature sensor is used in the United States of America DALLAS semiconductor company into production DS18B20, display circuit uses8 common cathode LED digital tube, ULN2803A is driven by the dynamic scanning of direct reading. Temperature control circuit composed of a thermometer sensor and a preset temperature value alarm circuit. When the measured temperature value is larger than the preset temperature value, send out alarm signal. System program, including the main program, testing Wen Zi program and display subroutine and so on. DS18B20new kind of single bus digital temperature sensor is the production company DALLAS digital temperature sensor, temperature measurement and A / D conversion in one. Direct digital output, has a simple interface, high precision, strong anti-interference ability, stable and reliable working characteristics.
Due to the adoption of the intelligent temperature sensor DS18B20as a detecting element, compared with the traditional thermometer digital thermometer, the decrease of the external hardware circuit, with low cost and easy to use features. DS18B20thermometer can also be in high temperature alarm, remote multipoint temperature measurement and control and other aspects of application development, has the very good development prospect.
Keywords: microcontroller temperature detection AT89S51 DS18B20
目录
第1章 引言 .............................................................. 1 1.1 本文研究的背景目的和意义............................................ 1 1.2 国外研究状况........................................................ 1 1.3 国内研究状况........................................................ 2 1.4本文研究主要内容 .................................................... 2 第2章 设计内容及性能指标 ................................................ 4 2.1温度检测技术介绍 .................................................... 4 第3章 系统方案论证与比较 ................................................ 6 第4章 系统器件选择 ...................................................... 7 4.1 单片机的选择........................................................ 7 4.2 温度传感器的选择.................................................... 9 4.2.1 DS18B20 简介.................................................... 9 4.2.2 DS18B20 使用中的注意事项....................................... 10 4.2.3 DS18B20 内部结构............................................... 11 4.2.4 DS18B20测温原理 ............................................... 12 4.2.5 提高DS18B20测温精度的途径..................................... 13 4.3 显示及报警模块器件选择............................................. 14 第5章 硬件设计电路 ..................................................... 15 5.1 主控制器........................................................... 15 5.2 显示电路........................................................... 15 5.2.1 并行译码显示方式............................................... 15 5.2.2 串行译码显示方式............................................... 16 5.3 温度检测电路....................................................... 16 5.4 温度报警电路....................................................... 19 第6章 软件设计 ......................................................... 21 6.1 概述............................................................... 21 6.2 主程序模块......................................................... 21
6.3 各模块流程设计..................................................... 22 6.3.1 温度检测流程................................................... 23 6.3.2 报警模块流程................................................... 24 6.3.3 中断设定流程................................................... 24 第7章 总结和体会 ....................................................... 25 参考文献 ................................................................ 26 致谢 .................................................................... 27 附录 .................................................................... 28
数字显示温度计的设计与研究
第1章 引言
1.1 本文研究的背景目的和意义
随着人们生活水平的不断提高,单片机无疑成为人们追求的目标之一。他给人们带来的方便是不可否定的,其中数字温度计就是一个典型的例子。但人们对他的要求越来越高,要是现代人工作,科研生活显得更好的更方便的设备需要从单片机技术入手,一切向着数字化发展,智能化控制为目标。
通过课程设计是我进一步熟悉了单片机的内部结构和工作原理,掌握了单片机应用系统设计的基本方法和步骤。通过学习MCS-51单片机,了解单片机在自动化装置中的作用以及掌握单片机的编程和调试方法,通过一个简单的实际输入控制以及显示系统,掌握protel和keil软件的使用。
随着单片机技术的不断发展,单片机在日用电子产品中的应用越来越广泛,温度传感器DS1620具有线性优良,性能稳定,灵敏度高,抗干扰能力强,使用方便等。广泛应用于冰箱,空调,粮仓等日常用生活中温度的测量和控制。
1.2 国外研究状况
最早的温度计是在1593年由意大利科学家伽利略(1564~1642)发明的。后来又相继出现华氏温度计、列式温度计、摄氏温度计,均用水银和酒精等制作,现在英、美国家多用华氏温度计,德国多用列氏温度计,而世界科技界和工农业生产中,以及我国、法国等大多数国家则多用摄氏温度计。随着科学技术的发展和现代工业技术的需要,测温技术也在不断地改进和提高。由于测温范围变得越来越广,根据不同的要求,又制造出不同需要的测温仪器:气体温度计、电阻温度计、温差电偶温度计、高温温度计等。而我需要研究的是数字温度计,它是通过一定的电路和温度传感器进行测控,将温度用数字准确的显示出来。数据显示比较直观而且测量精度也比较高,范围也比较大。
1