目录
摘 要 2
ABSTRACT 3
目 录 4
1 绪论 1
- 1 概述 1
- 2 国内外发展现状 1
2 系统总体方案设计 2 - 1 设计要求 2
1)可进行距离测量。 2
2) 采用数码管显示距离数据。 2
3) 可按键设置距离门限值 2
4) 具有报警功能 2 - 2 方案选择 2
-
- 1 单片机的选择 2
3 系统硬件设计 2
- 1 单片机的选择 2
- 1 整体方案设计 2
-
- 1 系统概述 2
-
- 2 系统框图 3
3-1 系统框图 3
- 2 系统框图 3
- 2 最小系统模块 3
-
- 1 STC89C52简介 3
(1)概述 3
(2)主要功能与特性 3
- 1 STC89C52简介 3
-
- 2 最小系统电路 4
图3-2 单片机最小系统 5
- 2 最小系统电路 4
- 3 HC-SR04模块 5
-
- 1 HC-SR04简介 5
T = (定时器0溢出次数 * (0XFF - 0XCE))/ 1000 6
- 1 HC-SR04简介 5
-
- 2 超声波的特性 6
图3-4 人的听觉范围 6
(1)束射特性 6
(2)吸收特性 7
(3) 超声波的能量传递特性 7
(4)超声波的声压特性 7
- 2 超声波的特性 6
-
- 3 超声波换能器 7
图3-5 超声波传感器结构 8
- 3 超声波换能器 7
-
- 4 超声波传感器原理 8
图3-6 超声波内部结构 9
1. 波长 9
2. 反射 9
3. 温度效应 10
- 4 超声波传感器原理 8
- 衰减 10
图3-7 声压在不同距离下的衰减特性 10
5.声压特性 10
图3-8 超声波传感器的声压图 11
6.灵敏度特性 11
图3-9 超声波传感器灵敏度示意图 11
7.辐射特性 11 -
- 5 测距分析 12
图3-11探测距离原理图 13
- 5 测距分析 12
- 4 显示模块 14
3.4.1 数码管简介 14
图3-12 数码管 14 -
- 2 数码管显示模块电路 15
图3-13 模块连接图 15
- 2 数码管显示模块电路 15
-
- 3 按键模块电路 15
图3-14 按键模块电路图 15
- 3 按键模块电路 15
-
- 4 报警模块电路 16
图3-15 报警模块电路图 16
4 软件设计 16
- 4 报警模块电路 16
- 1 程序语言及开发环境 16
- 2 程序流程图设计 17
-
- 1 超声波模块程序流程图设计 17
图4-1 超声波模块程序流程图 17
- 1 超声波模块程序流程图设计 17
-
- 2 主程序流程图设计 18
图4-2 主程序流程图 18
5 硬件组装与调试 18
- 2 主程序流程图设计 18
- 1 元器件的选择与测量 18
- 2 元件的焊接与组装 19
- 3 电路的调试 19
-
- 1 调试方法 20
-
- 2 调试步骤 20
(1)通电前检查 20
(2)通电观察 20
(3)单元电路调试 20
(4)整机联调 21
6 总结 22
参考文献: 23
致 谢 24
- 2 调试步骤 20
摘 要
使用超声波来测距有许多优势,例如不受光强度、色彩和电磁场等外界因素的干扰,而且超声波传感器的价位偏低、结构也比较简单,超声波以声速传播,便于收发与计算。在汽车倒车雷达、移动机器人的避障、尤其是测量距离等诸多方面都已有了十分广泛的运用。
本次毕业设计的超声波测距仪是在STC89C51单片机的基础上设计的,在剖析和了解了超声波的一些长处和特点后,又查阅了使用超声波测距的基本原理。在最后决定使用51单片机系统和超声波传感器一起组成。设计的超声波测距仪的硬件部分主要包括超声波接收模块、单片机与超声波模块组成的超声波发射模块、LED数码显示模块和扩展报警模块、电源及复位模块。软件部分主要包括单片机主程序、根据超声波发射与接收计算距离程序、LED距离显示程序、按键控制程序和蜂鸣器报警程序,这样安排使系统具有模块化的优点。系统易于进行控制,具备可靠地的性能和比较高的测量精度,最关键的是可以对距离进行实时测量。
关键词: 单片机; 超声波传感器; 数码显示; 报警
ABSTRACT
The use of ultrasonic ranging has many advantages such as no interference light intensity, color and electromagnetic field and other factors, and the ultrasonic sensor has the advantages of simple structure, low price, easy to send and receive ultrasonic at the speed of sound propagation, and calculation. It has been widely used in automobile reversing radar, obstacle avoidance of mobile robot, especially measuring distance and so on.
The graduation design of the ultrasonic range finder is based on the STC89C51 microcontroller design, in the analysis and understanding of some of the advantages and characteristics of ultrasound, but also access to the basic principles of ultrasonic ranging. In the final decision to use the 51 single-chip system and ultrasonic sensors together. The hardware design of the ultrasonic range finder includes ultrasonic receiving module, MCU module and ultrasonic transmitter module, LED digital display module and extended alarm module, power and reset module. The software includes the main microcontroller, according to ultrasonic transmitting and receiving distance, LED distance calculation program display program, key control procedures and buzzer alarm procedures, this arrangement allows the system has the advantages of modularity. The system is easy to control, with reliable performance and relatively high measurement accuracy, the most critical is that the distance can be measured in real-time.
Keywords: microcontroller; ultrasonic sensor; digital display; alarm
目 录
- 绪论 1
- 1 概述 1
- 2 国内外发展现状 1
- 系统总体方案设计 2
- 1 设计要求 2
- 2 方案选择 2
-
- 1 单片机的选择 2
- 系统硬件设计 2
- 1 整体方案设计 2
-
- 1 系统概述 2
-
- 2 系统框图 3
- 2 最小系统模块 3
-
- 1 STC89C52简介 3
-
- 2 最小系统电路 4
- 3 HC-SR04模块 5
-
- 1 HC-SR04简介 5
-
- 2 超声波的特性 6
-
- 3 超声波换能器 6
-
- 4 超声波传感器原理 8
-
- 5 测距分析 12