1、数字温度计 摘 要 本设计是一款简单实用的小型数字温度计,本文提出了基于 MCS-51 系列单片机的数字温度计的制作电路和编程思想。 该数字温度计以宏晶公 司的 STC89C52 单片机为主控,配以 DALLAS 公司的 DS18B20 数字温度传 感器,采用 LCD1602 双行英文字符液晶作显示。实现了对温度的测量,显 示和报警等功能。 本次数字温度计的设计共分为六部分:主控制器,复位电路,时钟电路, 传感器部分,显示部分,报警部分。主控制器、复位电路和时钟电路组成单 片机最小系统,用于存储程序和控制电路;传感器即温度传感器,用来采 集温度,进行温度转换;显示部分用来显示采集到的温度;当温
2、度不在预 设温度范围时,报警电路工作。 测温的总过程是传感器采集到外部环境温度, 并进行转换后传到单片 机,经单片机处理判断后将温度传递到显示器显示。 关键词:51 单片机,DS18B20 温度传感器,LCD1602 显示器 Digital Thermometer ABSTRACT The design is a simple and practical small digital thermometer, make circuits based on MCS-51 series single-chip digital thermometer and programming ideas. Th
3、e Digital Thermometer macrocrystalline STC89C52 microcontroller as master, together with the Dallas DS18B20 digital temperature sensor, LCD1602 two-line English character LCD display. Temperature measurement, display and alarm functions. The design of the Digital Thermometer is divided into six part
4、s: the main controller, reset circuit, clock circuit, sensor part, the display section, part of the alarm. Main controller, reset circuit and clock circuit composed of the smallest single-chip system, used to store programs and control circuit; sensor temperature sensor, used to collect temperature,
5、 temperature conversion; show used to display the collected temperature. The total process of the temperature measurement of the sensor to the external ambient temperature, and the converted to the microcontroller, judged by the microcontroller processing temperature will be passed to the monitor di
6、splay. When the temperature is outside the preset temperature range, the alarm circuit. KEY WORDS: 51 MCU DS18B20 temperature sensor, LCD1602 display 目录目录 前 言 5 第 1 章 系统总体设计. 6 1.1 设计方案论证与选择 . 6 1.1.1 显示电路方案 6 1.1.2 测温电路方案 6 1.2 基本设计方案. 7 第 2 章 硬件设计 9 2.1 DS18B20 温度传感器 . 9 2.1.1 DS18B20 内部结构及测温原理 . 9 2.1.2 DS18B20 的封装及引脚功能 11 2.1.3 DS18B20 的存储器 12 2.1.4 DS18B20 的操作命令 13 2.2 模块电路设计 15 2.2.1 时钟电路. 15 2.2.2 复位电路. 15 2.2.3 温度采集电路 . 16 2.2.4 显示电路. 17 2.2.5 报警电路. 17 第 3 章 软件设计 . 18 3.1 DS18B20 的读操作 1