基于单片机的数字温度计设计大学本科毕业论文

基于单片机的数字温度计的设计

摘 要

温度作为一个重要的物理量,是工业生产过程中最普遍、最常用的测量及被控参数之一。随着社会的发展、科学技术的不断更新,温度的测量范围要求不断扩大,同时温度的测量准确性要求不断提高。它直接影响燃烧、化学反应、发酵、烘烤、蒸馏、浓度、挤压成形、结晶以及空气流动等物理和化学过程。温度控制失误就可能引起生产安全、产品质量、产品产量等一系列问题, 因此对温度测量的意义就越来越大。

本文主要介绍了一个基于89S51单片机的测温系统,详细描述了利用数字温度传感器DS18B20开发测温系统的过程,重点对传感器在单片机下的硬件连接,软件编程以及各模块系统流程进行了详尽分析,对各部分的电路也一一进行了介绍,该系统可以方便的实现实现温度采集和显示,并可根据需要任意设定上下限报警温度,它使用起来相当方便,具有精度高、量程宽、灵敏度高、体积小、功耗低等优点,适合于我们日常生活和工、农业生产中的温度测量,也可以当作温度处理模块嵌入其它系统中,作为其他主系统的辅助扩展。DS18B20与AT89S51结合实现最简温度检测系统,该系统结构简单,抗干扰能力强,适合于恶劣环境下进行现场温度测量,有广泛的应用前景。本文主要包括两个方面的设计:一方面是硬件电路的设计,另一方面是系统程序的设计。其中,硬件电路各部分组成如下:中央控制器采用单片机AT89S51,温度检测部分采用DS18B20温度传感器,用LCD液晶1602作为显示器。其次,系统软件程序包括主程序,温度值读取、转换及计算程序,显示数据刷新程序等。该温度计整体功能的实现是通过温度传感器DS18B20采集温度信号送该给单片机处理,单片机再把温度数据送液晶显示器1602显示。

关键词:单片机;温度传感器;DS18B20;LCD液晶显示器

第 1 页 共 37 页

THE DESEGN OF THE ELECTRONIC THERMOMETER

BASED ON MICROCONTROLLER

Abstract

Temperature as an important physics, is the most common industrial production process, the most commonly used one of measuring and controlled parameter. With the development of society, the science and technology unceasing renewal, temperature measurement range requirements, at the same time expanding temperature measurement accuracy requirement enhances unceasingly. It directly affects combustion, chemical reaction, fermentation, roasted, distillation, concentration, extrusion, crystallization and air flow etc physical and chemical processes. Temperature control error could cause a production safety, product quality, product yield and so on. So the significance of temperature measurement is more and more big.

This paper describes the digital thermometer which is consisted of the central controller, temperature detectors, monitors and police components.The thermometer’s basic range is from -50 ℃ to 110 ℃,its accuracy error is less than 0.5 ℃ and LCD directly shows numerical temperature. When the measured temperature exceed the limit alarm doors, the system will output alarm signal.The paper includes tow aspects of the design: one is hardware circuit design, the other is the system process design. Among them, the hardware components are as following: the central controller SCM AT89S51,the temperature detection DS18B20 part of a temperature sensor,and LCD monitors, as LCD 1602 F; the system software programs, including the main program, the temperature reading, conversion and calculation procedures, the data show that refresh procedures and so on.Temperature Sensor DS18B20 acquisition of the temperature signal sent to SCM

第 2 页 共 37 页

for processing, SCM then the temperature data sent 1602 F LCD display.

Key words: temperature sensor;DS18B20;LCD liquid crystal display

目 录

1 绪论 .............................................................. 5

1.1 设计背景及目的 ............................................... 5 1.2 设计研究方法 ................................................. 6 1.3 设计构成及内容 ............................................... 7 2 数字温度计硬件电路的实现 .......................................... 8

2.1 单片机的选取和介绍 ........................................... 8

2.1.1 引脚描述 ............................................... 8 2.1.2 特殊功能寄存器与存储结构 .............................. 10 2.1.3 编写方法 .............................................. 11 2.2 复位电路及晶振电路设计 ...................................... 12

2.2.1 复位电路 .............................................. 12 2.2.2 晶振电路 .............................................. 12 2.3 温度传感器设计 .............................................. 12

2.3.1 DS18B20的外形及内部结构 ............................... 12 2.3.2 DS18B20工作原理 ....................................... 15 2.3.3 DS18B20的外部电路图 ................................... 15 2.4 液晶显示电路设计 ............................................ 16

2.4.1 1602的引脚功能介绍 .................................... 16 2.4.2 1602液晶模块内部的控制指令 ............................ 17 2.4.3 1602的外部电路图 ...................................... 18

3 数字温度计软件设计流程 ........................................... 19

3.1 主程序设计 .................................................. 19

第 3 页 共 37 页

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4