基于AT89C51单片机的可燃气体报警器设计

摘要

本设计利用GS系列传感器,将置于测试环境中待测气体的浓度转换为模拟电压,再通过ADC0809将模拟电压转换为数字信号,送入单片机AT89C51中进行处理。为了用户对气体浓度进行实时了解,将AT89C51外接3片74LS164作为3位LED显示器的静态显示接口,把单片机的RXD作为数据输出线,TXD作为移位时钟脉冲。74LS164为TTL单向8位移位寄存器,可实现串行输入,并行输出,通过8位移位寄存器74LS164可进行静态显示。通过设置报警值,用单片机控制发光二极管和音乐IC同时报警。利用单片机控制技术,制作了程控一氧化碳报警器。该仪器对一氧化碳(CO)进行实时监控,当一氧化碳的浓度超过允许值时,控制电路进行报警,并通过外接排风扇与电磁阀对其进行程控,以防事故的发生。另外为了防止程序陷入死循环,还利用x25045芯片组成的看门狗电路在程序陷入死循环时让单片机复位,而不用整个系统断电,从而保护了硬件电路。

由于所设计的数字气体报警器采用单片机AT89C51,其价格便宜,性能稳定,易于产品化。以GS气体传感器和AT89C51 单片机为核心, 设计气体泄漏报警器,该报警器设计方法简单易行,使用效果良好,下面给出了气体泄漏报警器的总体设计原理,关键的硬件电路和所有的软件程序设计。

关键词: 一氧化碳; 气体泄露报警器; AT89C51单片机; GS气体

传感器

I

Abstract

The design of the GS series of sensors, will be placed on the test

environment measured the concentration of gas converted to analog voltage, and then through the ADC0809 will be converted to analog voltage digital signal, into the SCM AT89C51 in the process. To users of gas concentrations in real-time understanding, AT89C51 will be linked three 74 LS164 externally as the three LED display static display interface, and the MCU RXD as the output data line, TXD as a shift clock pulse. 74LS164 TTL is a one-way 8-bit register

displacement which can be realized enter serial, parallel output, through the 8-bit shift register 74 LS164 can be static display. By setting the alarm level, the MCU control LED and music IC alarm at the same time.SCM control use of technology, produced a program-controlled carbon monoxide alarm. The instrument of carbon monoxide (CO) for real-time monitoring, when the concentration of carbon monoxide is more than allowed value, the control circuit for alarm, and through an external electromagnetic valve row fans and their program-controlled, to prevent accidents. In addition procedures to prevent a cycle of death, also used x25045 watchdog circuit chip composed of a death in the process so that when the MCU reset cycle, instead of the whole system off, thereby protecting the hardware circuit.

As designed by the number of gas alarm using SCM AT89C51, it is cheap, stable performance, easy-production. GS to gas sensors and AT89C51 microcontroller as the core design of gas leakage alarm, the alarm system design method is simple, use good effect, the following is a gas leakage alarm the general design principles, the key hardware and all The software program design.

Keywords: CO; Leaking gases alarm; AT89C51 microcomtuper;

GS Gases Sensors

II

目 录

摘要 ································································································I Abstract····························································································II

1 绪论 ·····························································································1 1.1研究背景及意义 ·······································································1 1.2研究目标及实现功能 ·································································2 1.3研究方案 ·················································································3 1.4我国报警器行业的发展 ······························································4 2 单片机相关知识介绍 ·······································································6 2.1单片机中断与复位 ····································································6 2.1.1单片机中断系统 ···································································· 2.1.2单片机复位电路 ···································································· 2.2AT89C51单片机对ADC0809的接口 ··············································8 2.3AT89C51的介绍 ········································································· 3 硬件部分的设计及调试 ····································································9 3.1硬件部分的设计 ·······································································9

3.1.1系统的组成 ········································································9 3.1.2系统各模块功能 ··································································9 3.1.3系统的控制 ········································································12 3.1.4系统主要器件的介绍 ···························································· 3.2硬件电路的调试 ·······································································12 4 软件部分的设计及调试 ···································································13 4.1软件部分的设计 ·······································································13

4.1.1主程序 ··············································································14 4.1.2调零子程序 ········································································15 4.1.3显示子程序 ········································································16 4.1.4报警子程序 ········································································17 4.1.5中断取值子程序 ··································································19 4.2软件程序的调试 ·······································································22 结论 ································································································41 致谢 ································································································23 参考文献 ··························································································24

III

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