摘 要
温度检测仪是一种非常重要的测温设备,广泛应用于建筑工业场所,温度检测系统中的信息对城市供暖、新型建筑材料的特性检验、建筑节能、空暖与热网、空调系统、通风、排水网与燃气配管网等系统的特性与运行研究起着至关重要的作用,这也是本文研究温度检测系统的意义所在。
本文主要设计了一种多路温度巡检系统的方案。该系统主要完成以单片机STC 12C5A16AD系统为核心,采用8路K型热电偶传感器和多路开关CD4051,从而实现对8路温度巡回采集,并且采用MAX6675芯片完成对热电偶微弱信号的放大、冷端补偿和A/D转换等功能。将转换后的采样值送入单片机进行数据处理来确定其温度值。单片机通过对数字信号处理,并在数码管上显示。本文从硬件和软件两个方面介绍了设计的实现方法,其中硬件设计的重点是单片机最小系统、电源电路、温度检测电路、多通道切换电路、A/D转换电路、显示电路、按键电路、报警电路,软件设计的重点是系统总体流程设计、显示模块、按键模块、A/D转换模块、报警指示模块。
经过仿真测试结果表明,本系统测量速度快、测量精度高、测量范围广,达到了系统的指标要求,工作可靠,操作简单,用户界面友好。
关键词:温度检测仪,单片机,热电偶,多通道切换
I
Abstract
Temperature detector is a kind of very important temperature measuring equipment, which is widely used in the construction industry place, temperature detection system in the information of urban heating, new building material property test, the construction of energy-efficient, empty warm and heat supply network, air-conditioning system, ventilation, drainage network and gas piping network system characteristics and operation of research plays a vital role and the significance of which is the study of the temperature detection system.
This paper designed a multi-channel temperature measuring system scheme. This system mainly completes STC12C5A16AD microcontroller system as the core, the 8 K type thermocouple sensor and multi-channel switch CD4051, so as to realize the temperature circuit acquisition, and by using MAX6675 chip to complete the thermocouple weak signal amplification, cold junction compensation and A/D conversion function. The sampling values into the SCM data processing to determine the temperature value. The MCU through the digital signal processing and digital tube display.This paper describes the hardware and software aspects of the design implementation, focusing on where the hardware design is the smallest single-chip system, the power supply circuit, the temperature detection circuit, a multi-channel switching circuit, A/D converter circuit, display circuit, key circuit alarm circuit, focusing on the overall system software design process design, display module, button module, A/D converter module, alarm indication module.
According to the simulation test results show that the system fast measurement speed, high measurement precision, measurement range wide, can satisfy the requirements of system of indicators, reliable work, simple operation, the user interface friendly.
Keywords:Temperature detector, microcontroller, thermocouple, multi-channel switch
II
目 录
摘 要 .............................................................................................................................................. I Abstract ....................................................................................................................................... II 目 录 ......................................................................................................................................... III 第1章 绪论 ............................................................................................................................. 1
1.1 系统背景 ........................................................................................................................ 1 1.2 系统来源及现状 ............................................................................................................ 2
1.2.1 系统的来源 ......................................................................................................... 2 1.2.2 温度检测仪表的现状 ......................................................................................... 2 1.3 系统概述 ........................................................................................................................ 3 1.4 本文的研究的主要内容 ................................................................................................ 3 第2章 系统方案设计论证 ................................................................................................. 4
2.1 系统的基本设计方案 .................................................................................................... 4 2.2 系统的工作原理 ............................................................................................................ 4 2.3 系统的方案设计与比较 ................................................................................................ 5
2.3.1 单片机的选择 ..................................................................................................... 5 2.3.2 温度传感器的选择 ............................................................................................. 5 2.3.3 多通道切换电路的选择 ..................................................................................... 6 2.3.4 键盘的选择 ......................................................................................................... 6 2.3.5 显示模块的选择 ................................................................................................. 7 2.3.6 报警电路的选择 ................................................................................................. 7 2.4 方案的论证及确定 ........................................................................................................ 7 2.5 本章小结 ........................................................................................................................ 8 第3章 系统硬件设计 .......................................................................................................... 9
3.1 单片机最小系统的设计 ................................................................................................ 9 3.2 电源电路的设计 .......................................................................................................... 11 3.3 温度检测电路的设计 .................................................................................................. 12 3.4 多通道切换电路的设计 .............................................................................................. 13 3.5 A/D转换电路的设计 ................................................................................................... 14
3.5.1 模拟信号的放大 ............................................................................................... 16 3.5.2 热电偶的冷端补偿 ........................................................................................... 16 3.5.3 信号的A/D转换 ............................................................................................... 16 3.6 显示电路的设计 .......................................................................................................... 16 3.7 按键电路的设计 .......................................................................................................... 17 3.8 报警电路的设计 .......................................................................................................... 18 3.9 本章小结 ...................................................................................................................... 19 第4章 系统软件设计 ........................................................................................................ 20
4.1系统主程序的设计 ....................................................................................................... 20 4.2 显示子程序的设计 ...................................................................................................... 21 4.3 按键子程序的设计 ...................................................................................................... 23 4.4 A/D转换子程序的设计 ............................................................................................... 25 4.5 报警子程序的设计 ...................................................................................................... 26 4.6 本章总结 ...................................................................................................................... 26
I II
第5章 系统调试 ................................................................................................................. 27
5.1 软件系统调试 .............................................................................................................. 27 5.2 硬件系统仿真调试 ...................................................................................................... 28 5.3 实物调试 ...................................................................................................................... 31 5.4 本章总结 ...................................................................................................................... 32 第6章 总结 ........................................................................................................................... 33 致 谢 ......................................................................................................................................... 34 参考文献 .................................................................................................................................. 35 附录 ........................................................................................................................................... 37
原理图 .................................................................................................................................. 37 部分程序 .............................................................................................................................. 38
IV
第1章 绪论
1.1 系统背景
测量是运用专业的工具,根据生物、物理、化学等原理,通过计算与实验得到被测量的数据。测量的目的是尽量准确的及时收集到被测量的状态信息,以便于对生产的过程进行准确的控制。测量是人类认识和改造世界的一种不可缺少和代替的手段。历史事实也已经证明:科学的进步,生产的进步与发展是相互促进与依赖的。测量技术反映一个国家的科学技术发展的水平。测量水平的发展与科学技术的进步是密切相关的。可以这么说,评价一个国家的科技水平,最简单方便的办法就是看这个国家的测量出的水平与测量出来的数据是如何被运用的。
在建筑测量的热工特性;暖通空调领域中,空调、供暖、制冷效果的检验;对建筑节能的研究;对新型建筑材料特性的检验;空暖与热网,空调系统、通风、排水网与燃气配管网等系统的特性与运行研究中,都需要对压力、温度等参数进行测量。
这些领域的测量具有本身具备的特点,例如在供暖网的系统中,它存在以下的特点:
(1)需要分时记录管网运行参数。要对管网的运行进行分析与研究,管网的分时运行参数的测量和记录特别重要。一般要求在管网运行时期,按规定的顺序检测与记录运行的参数。
(2)测量点分散,作用半径较大。就拿一个城市的集中供暖网的系统来说,它的系统大,覆盖面广。这样对供暖网不通点的运行参数进行测量时,测量点就相当分散。
除此之外还有节能建筑的效果检验,它需要对非节能建筑与节能建筑之间的功耗进行比较,这一样需要对建筑物内的房间进行分时的测量与记录。但它也存在和供暖效果检验的一样困难。另外一些其他的专业的科学实验中,温度也是一个特别重要测量参数。
综上所述,由于温度的测量存在上面所提到的问题,就需要由一种使用便利的测量仪表,能进行实时的检测,能进行对数据的记录,不需要人为干预其长期自动运行。所以本文设计了一种方便使用的数码显示温度数据,采用热电偶温度传感器来将温度信号转换为电压信号,并运用冷端补偿的方法来消除热电偶的测量误差。本温度传感器在设计的时候,为了满足多路巡检这个要求,采用了8路热电偶传感器轮流进行检测,从而实现对多路温度巡检的实时数据进行采集。采用稳压电源来给位处理器进行供电,这样可以省去电池供电所带来的如电压不稳定、作用时间不长以及电压的下降而影响整个系统的工作精度于稳定性的问题。
1