基于单片机的粉尘检测仪控制程序设计 联系客服

发布时间 : 星期三 文章基于单片机的粉尘检测仪控制程序设计更新完毕开始阅读447c8fd3b9f3f90f76c61b87

I 基于单片机的粉尘检测仪控制程序设计

摘 要

随着社会的进步,工业化水平的提高,环境污染问题越来越严重,维护生态环境质量越来越成为社会的迫切要求。环境污染除废气、废水外,颗粒状粉尘、烟尘向大气排放所造成的空气污染已成为一个十分突出的问题,所以空气质量的提高备受关注。粉尘是空气质量的重要指标,所以粉尘的检测就很重要,因此粉尘检测仪成为环保监测部门及很多工矿企业的必备品。

粉尘检测仪主要用于检测环境中的粉尘浓度,适用于工矿企业劳动部门生产现场粉尘浓度的测定、环境环保监测部门大气飘尘检测和污染源调查等。

本文所设计的粉尘检测仪围绕单片机为控制核心,完成数据的采集、显示、参数设置及报警等系统各模块的程序设计,结合各模块的硬件电路实现每个模块的功能,从而实现整个系统的功能。

关键词:粉尘,单片机,A/D转换,显示,程序设计

II Program Designing on Dust Concentration

Based on Single Chip Detector

ABSTRACT

Along with social progress, raising the level of industrialization, environmental pollution problem is getting worse, more and more to maintain environmental quality become an urgent requirement. In addition to environmental pollution, waste gas, waste water, the particles of dust, smoke and dust emissions to the atmosphere caused by air pollution has become a very prominent issue; so the improvement of air quality concern. Dust is an important indicator of air quality, so it is important to the detection of dust. Therefore, environmental monitoring of the dust detector into many industrial and mining sector and essential goods.

Dust detector is mainly used for detection of dust concentration in the environment, the labor department for industrial and mining production site determination of dust concentration, the environment department of environmental monitoring of airborne particulate pollution detection and investigation.

This dust detector designed for the control of the core around the MCU to complete the data collection, display, parameter setting and alarm of the programming of each module, with each module of the hardware circuit for each module, enabling the whole system Function.

KEY WORDS: dust, SCM, A/D conversion, display, programming

III 目 录

摘 要 .................................................................... I ABSTRACT ................................................................ II 1 绪论 ................................................................... 1

1.1 前言 .............................................................. 1 1.2 选题背景 .......................................................... 1 1.3 国内外发展状态 .................................................... 1

1.3.1 粉尘测量方法 ................................................ 2 1.3.2 粉尘检测仪的性能与优点 ...................................... 2 1.3.3 研究的意义 .................................................. 3 1.4 本文主要工作 ...................................................... 3 2 粉尘浓度测试仪系统设计方案 ............................................. 4

2.1 系统的功能和技术指标 .............................................. 4 2.2 工作原理 .......................................................... 4

2.2.1 粉尘检测原理 ................................................ 4 2.2.2 系统工作原理 ................................................ 5 2.3 系统设计方案的确立 ................................................ 5

2.3.1 中心控制器 .................................................. 6 2.3.2 各外围电路模块 .............................................. 8 2.4 程序框图和流程图 .................................................. 8

2.4.1 程序框图设计 ................................................ 8 2.4.2 粉尘检测仪程序主流程设计 .................................... 9

3 粉尘测试仪的程序设计 .................................................. 11

3.1 编程语言的选择 ................................................... 11

3.1.1 C语言的优点 ................................................ 11 3.1.2 单片机C语言与一般C语言的异同 ............................. 11 3.2 控制器内部存储空间分布 ........................................... 12 3.3 浓度参考值的键盘设定程序设计 ..................................... 16

3.3.1 键盘扫描的设计 ............................................. 16 3.3.2 浓度参考值设定的设计 ....................................... 17 3.3.3 键盘设定浓度参考值的程序 ................................... 17 3.4 信号采集部分的程序设计 ........................................... 19

3.4.1 A/D转换器的选择 ............................................ 19

IV 3.4.2 ADC0809的工作特性 .......................................... 21 3.4.3 ADC0809数据采集时序图 ...................................... 21 3.4.4 数据采集流程图设计 ......................................... 21 3.4.5 信号采集的程序设计 ......................................... 22 3.5 数码管显示部分的程序设计 ......................................... 23

3.5.1 LED数码管的选择 ............................................ 23 3.5.2 显示方式的选择 ............................................. 24 3.5.3 显示接口的程序设计 ......................................... 25 3.5.4 显示流程图设计 ............................................. 25 3.5.5 显示程序设计 ............................................... 26 3.6 按键控制显示转换部分和蜂鸣器报警部分程序设计 ..................... 27

3.6.1 按键控制显示转换程序设计 ................................... 27 3.6.2 蜂鸣器报警程序设计 ......................................... 28 3.7 看门狗部分的程序设计 ............................................. 30

3.7.1 复位电路的选择 ............................................. 30 3.7.2 看门狗流程图设计 ........................................... 30 3.7.3 看门狗程序设计 ............................................. 31 3.8 定时中断程序的设计 ............................................... 31

3.8.1 C51中断处理过程 ............................................ 31 3.8.2 定时/计数器使用步骤 ........................................ 31 3.8.3 定时计数初值的计算 ......................................... 32 3.8.4 定时应用程序设计 ........................................... 32

4 编译器的选择与程序的编译调试及其结果 .................................. 34

4.1 编译器的选择 ..................................................... 34

4.1.1 keil C51的功能及优点 ....................................... 34 4.1.2 keil C51软件的使用步骤 ..................................... 35 4.2 程序文件的编译、连接、调试及其结果 ............................... 35

4.2.1 编译连接环境设置 ........................................... 35 4.2.2 程序的编译和连接及其结果 ................................... 36

5 结论 .................................................................. 38 致谢 .................................................................... 39 参考文献 ................................................................ 40 附录 .................................................................... 41