基于51单片机的数字温度计设计__本科毕业设计论文 下载本文

内容发布更新时间 : 2024/6/3 19:58:31星期一 下面是文章的全部内容请认真阅读。

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

摘要 随着现代信息技术的飞速发展和传统工业改造的逐步实现.能够独立工作的温度检测和显示系统应用于诸多领域。这里设计的数字温度计采用DS18B20为传感器,选用AT89C51型单片机作为主控制器件,通过4位一体共阳极的数码管进行温度显示。与热敏电阻为温度敏感元件的温度计相比,该数字温度计具有读数方便,测温范围广,测温精确等特点。另外,还在该温度计中加入了秒表计时的功能,能够实现“分,秒”的计时显示,并且,两种功能能够用按键实现切换。

关键词:AT89C51;DS18B20传感器;温度;秒表

Abstract:

With the development of modern information technology and the progressive of the traditional industrial transformation. Using DS18B20 as the sensor of the digital thermometer , AT89C51 microcontroller as the main control device,and the four digital tube are used to display. Compared with the thermometer thermistor for temperature sensitive element,the digital thermometer have many advantages,for example,it’s can get temperature more convenient, wider,and more accurate.In adition, The digital thermometer also as a stopwatch,according to the minutes and seconds.And with the pressing of the keys,we can choose the different functions of the digital thermometer.

Key words: AT89C51;DS18B20;the temperature;stopwatch

目 录

1 系统硬件设计方案.................................................................................................... 1

1.1 单片机选择...................................................................................................... 1 1.2 温度传感器介绍.............................................................................................. 2 1.3 温度传感器与单片机的连接.......................................................................... 4 1.4 复位电路.......................................................................................................... 5 1.5 时钟电路.......................................................................................................... 5 1.6 按键电路.......................................................................................................... 6 1.7 显示电路.......................................................................................................... 6 1.8 电源电路和系统供电...................................................................................... 8 2 软件设计.................................................................................................................... 9

2.1 DS18B20测温 .................................................................................................. 9

2.1.1 DS18B20复位 ........................................................................................ 9 2.1.2 DS18B20读写逻辑0与1 ................................................................... 10 2.1.3单片机访问DS18B20 .......................................................................... 10 2.1.4 DS18B20程序设计 .............................................................................. 11 2.2 秒表程序设计................................................................................................ 11 2.3 按键功能........................................................................................................ 12 3 系统测试.................................................................................................................. 13

3.1 测试方案........................................................................................................ 13 3.2 测试条件与仪器............................................................................................ 13 3.3 测试结果及分析............................................................................................ 13 4 系统特色.................................................................................................................. 14 5 心得和体会.............................................................................................................. 14 6 参考文献.................................................................................................................. 15 附录1:电路原理图................................................................................................... 16 附录2:实物图........................................................................................................... 16 附录3:仿真测试图................................................................................................... 17 附录4:源程序........................................................................................................... 18

II

数字温度计设计

1 系统硬件设计方案

作品主要利用AT89C51单片机、DS18B20数字温度传感器而设计的数字温度计,实现对空气温度的测量。

图1 系统原理结构框图

如图1所示,该温度计通过ds18b20数字传感器进行采集,将数据传送给单片机,程序通过按键对单片机进行操作,然后再数码管上显示。

1.1 单片机选择

AT89C51作为温度测试系统设计的核心器件。该器件是INTEL公司生产的MCS一5l系列单片机中的基础产品,采用了可靠的CMOS工艺制造技术,具有高性能的8位单片机,属于标准的MCS—51的CMOS产品。不仅结合了HMOS的高速和高密度技术及CHMOS的低功耗特征,而且继承和扩展了MCS—48单片机的体系结构和指令系统。单片机小系统的电路图如图2所示。

图2 单片机小系统电路