摘 要
超声波具有指向性强,能量消耗缓慢,传播距离较远等优点,所以,在利用传感器技术和自动控制技术相结合的测距方案中,超声波测距是目前应用最普遍的一种,它广泛应用于防盗、倒车雷达、水位测量、建筑施工工地以及一些工业现场。
本课题详细介绍了超声波传感器的原理和特性,以及Atmel公司的AT89C51单片机的性能和特点,并在分析了超声波测距的原理的基础上,指出了设计测距系统的思路和所需考虑的问题,给出了以AT89C51单片机为核心的低成本、高精度、微型化数字显示超声波测距仪的硬件电路和软件设计方法。该系统电路设计合理、工作稳定、性能良好、检测速度快、计算简单、易于做到实时控制,并且在测量精度方面能达到工业实用的要求。
关键词:超声波 单片机 测距 AT89C51
1
Abstract
Ultrasonic wave has strong pointing to nature ,slowly energy consumption ,propagating distance farther ,so, in utilizing the scheme of distance finding that sensor technology and automatic control technology combine together ,ultrasonic wave finds range to use the most general one at present ,it applies to guard against theft , move backward the radar , water level measuring , building construction site and some industrial scenes extensively。
This subject has introduced principle and characteristic of the ultrasonic sensor in detail ,and the performance and characteristic of one-chip computer AT89C51 of Atmel Company ,and on the basis of analyzing principle that ultrasonic wave finds range ,the systematic thinking and questions needed to consider that have pointed out that designs and finds range ,provide low cost , the hardware circuit of high accuracy , ultrasonic range finder of miniature digital display and software design method taking AT89C51 as the core ,this circuit of system is reasonable in design, working stability, performance good measuring speeding soon , calculating simple , apt to accomplish real-time control ,and can reach industry's practical demand in measuring the precision 。
Key Words: Ultrasonic wave; One-chip computer; Range finding; AT89C51
2
目 录
摘 要 ............................................................ 1 目 录 ......................................................... 3 第1章 超声波测距系统设计 ....................................... 5 1.1 超声波测距的原理 .......................................... 5 1.2超声波测距系统电路的设计 ................................... 5 1.2.1 总体设计方案.......................................... 5 1.2.2发射电路的设计 ......................................... 6 1.2.3接收电路的设计 ......................................... 7 1.2.4显示模块的设计 ......................................... 8 1.3超声波测距系统的软件设计 ................................... 9 1.4本章小结 .................................................. 11 第2章 绪论 ..................................................... 12 2.1 课题背景,目的和意义...................................... 12 2.2两种常用的超声波测距方案 .................................. 12 2.2.1基于单片机的超声波测距系统 ............................ 12 2.2.2基于CPLD的超声波测距系统 ............................. 13 2.3课题主要内容 .............................................. 14 第3章 超声波传感器 ............................................. 15 3.1超声波传感器的原理与特性 .................................. 15 3.1.1原理 .................................................. 15 3.1.2特性 .................................................. 16 3.2超声波传感器的检测方式 .................................... 17 3.3超声波传感器系统的构成 .................................... 18 3.4本章小结 .................................................. 19 第4章 AT89C51单片机简介........................................ 20 4.1单片机基础知识 ............................................ 20 4.1.1单片机的内部结构 ...................................... 20 4.1.2单片机的基本工作原理 .................................. 22 4.2单片机的分类及发展 ........................................ 23 4.3单片机AT89C51的特性 ...................................... 24 4.4本章小结 .................................................. 27 第5章 电路调试及误差分析 ....................................... 28 5.1电路的调试 ................................................ 28 5.2系统的误差分析 ............................................ 28 5.2.1声速引起的误差 ........................................ 28 5.2.2单片机时间分辨率的影响 ................................ 29 5.4本章小结 .................................................. 30 结论 ............................................................ 31
3
致谢 ............................................................ 32 参考文献 ........................................................ 33 附录1........................................................... 34 附录2........................................................... 39 附录3........................................................... 40 代做本论文毕业设计实物。 代做专科、本科各个专业毕业论文。 代做电子、机械类专业毕业设计。
完全按照毕业设计指导书做,指导毕业答辩。淘宝交易:zylwcc2005.taobao.com QQ: 1226388638
4
第1章 超声波测距系统设计
1.1 超声波测距的原理
单片机发出超声波测距是通过不断检测超声波发射后遇到障碍物所反射的回波, 从而测出发射和接收回波的时间差t,然后求出距离
S?ct2 (1-1)
式(1-1)中的c为超声波在空气中传播的速度。
限制该系统的最大可测距离存在四个因素:超声波的幅度、反射物的质地、反射和入射声波之间的夹角以及接收换能器的灵敏度。接收换能器对声波脉冲的直接接收能力将决定最小可测距离。为了增加所测量的覆盖范围,减少测量误差,可采用多个超声波换能器分别作为多路超声波发射/接收的设计方法。由于超声波发球声波范围,其波速c与温度有关,表1-1列出了几种不同温度下的波速。
温度(℃) 声速(m/s) -30 313 表1-1 声速与温度的关系
-20 -10 0 10 319 325 323 338 20 344 30 349 100 386 波速确定后,只要测得超声波往返的时间t,即可求得距离S。其系统原理框图如图1-1所示。
图1-1 超声波测距系统框图
单片机AT89C51发出短暂的40kHz信号,经放大后通过超声波换能器输出;反射后的超声波经超声波换能器作为系统的输入,锁相环对此信号锁定,产生锁