超声波测距系统本科毕业论文

盐城工学院本科生毕业论文 (2010)

LED_temp(dis); bell=1;

show(10); //测量数据显示 } }

TO=0;

show(10);

key();

if(show_temperature==1)goto T_show;

} }

//如果WD为0则只显示温度

//-------------------------------------------- void int1(void) interrupt 0 //外部中断0服务 {

TR1=0; //停止计数 EX1=0; //关外部中断1 flag=1; }

//-------------------------------------------- void timer1(void) interrupt 3 //T1定时器中断服务 {

// ET1=0; //关中断 EX1=0; //关外部中断1 TR1=0; //关定时 TO=1;

temp[0]=0xF7; //未收到回波则显示 --- temp[1]=0xF7; temp[2]=0xF7; }

41

超声波测距系统的设计与实现

超声波测距系统的设计 摘要:超声波是指频率在20kHz以上的声波,它属于机械波的范畴。超声波也

遵循一般机械波在弹性介质中的传播规律,如在介质的分界面处发生反射和折射现象,在进入介质后被介质吸收而发生衰减等。正是因为具有这些性质,使得超声波可以用于距离的测量中。随着科技水平的不断提高,超声波测距技术被广泛应用于人们日常工作和生活之中。

系统的设计主要包括两部分,即硬件电路和软件程序。硬件电路主要包括单片机电路、发射电路、接收电路、显示电路和电源电路,另外还有复位电路和LED控制电路等。我采用以AT89s52单片机为核心的低成本、高精度、微型化数字显示超声波测距仪的硬件电路。整个电路采用模块化设计,由信号发射和接收、供电、温度测量、显示等模块组成。发射探头的信号经放大和检波后发射出去,单片机的计时器开始计时,超声波被发射后按原路返回,在经过放大带通滤波整形等环节,然后被单片机接收,计数器停止工作并得到时间。温度测量后送到单片机,通过程序对速度进行校正, 结合两者实现超声波测距的功能。软件程序主要由主程序、预置子程序、发射子程序、接收子程序、显示子程序等模块组成。它控制单片机进行数据发送与接收,在一定温度下对超声波速度的校正,还有实现数据正确显示在LED上。另外程序控制单片机消除各探头对发射和接收超声波的影响。相关部分附有硬件电路图、程序流程图。

实际的环境对超声波有很大的影响,如外部电磁干扰电源干扰信道干扰等等,空气的温度对超声波的速度影响也很大。此外供电电源也会使测量差生很大的误差。再设计的过程中考虑了这些因素,并给出了一些解决方案。

关键词:AT89c52;超声波;测距

42

盐城工学院本科生毕业论文 (2010)

Ultrasonic ranging system design

Abstract: ultrasonic frequency in the above 20kHz refers to the sound wave,

it belongs to the category. Ultrasonic wave in general also follow the rules of the elastic medium, such as the boundary of the reflection and refraction phenomenon occurring in the media and after absorbing attenuation etc. Because these properties, ultrasonic can be used in measuring the distance. Along with the science and technology unceasing enhancement, ultrasonic technology has been widely applied in People's Daily life and work. The thesis mainly includes two parts, the design that hardware circuit and software program. The hardware circuit including microcontroller circuit, launch circuit, receiving circuit, display circuit and power circuit, in addition to reset circuit and control circuit LED etc. I used to AT89s52 SCM is the core of low cost, high precision, miniaturization digital display ultrasonic rangefinder hardware circuit. The circuit USES modular design, the signal transmission and reception, power supply, temperature measurement, display module. The launch of the probe signal amplifier and detection after the launch of the timer started out, microcontroller timer, ultrasonic was launched by the way, after the return on amplified bandpass filters orthopedics etc, then received by MCU, counter to stop work and time. After temperature measurement of single-chip microcomputer, through the procedure to speed adjustment, the realization of the ultrasonic ranging function. Software program mainly by the main program, preset subroutines, launch procedure, receiving subroutines, display subroutines etc modules. It control chip, sending and receiving data in a certain temperature of ultrasonic velocity correction, and data displayed correctly in LED. Another program control chip to eliminate the emitting and receiving ultrasonic probe. With the hardware circuit and relevant parts of the program flowchart. The actual environment has great influence on ultrasonic, such as external electromagnetic interference source channel interference etc, the temperature of the air of ultrasonic velocity are significantly affected. Besides supply power will also make great difference measurement errors. In the process of design to consider these factors, and proposes some solutions.

Keywords: AT89c52, Ultrasonic, distance

43

盐城工学院本科生毕业论文 (2010)

目 录

1 概述............................................................1 2 课题研究背景及意义..............................................1 2.1 课题研究背景....................................................1 2.2 课题研究意义....................................................1 3 方案设计和选择..................................................2 3.1 超声波测距的原理................................................2 3.2 单片机AT89S52...................................................3 3.3 超声波传感器....................................................5 3.4 CAD简介.........................................................7 4 硬件电路设计....................................................7 4.1 整体电路设计....................................................7 4.2 超声波测距系统设计............................................. 9 4.3 显示电路设计....................................................16 4.4 电源电路设计 ...................................................17 4.5 硬件电路设计优化................................................19 5 软件设计........................................................22

5.1 程序完成的功能..................................................23 5.2 程语言的选择................................................... 23 5.3 主要部分程序流程图...............................................24 5.4 实现重要功能的程序的分析.........................................25 6 结束语 ..........................................................28 致 谢 ..........................................................29 参考文献............................................................ 30 附录一 pcb图........................................................32 附录二 程序代码......................................................33

毕业设计(论文)原创性声明和使用授权说明

原创性声明

本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。尽我所知,除文中特别加以标注和致谢的地方外,不包含其他人或组织已经发表或公布过的研究成果,也不包含我为获得 及其它教育机构的学位或学历而使用过的材料。对本研究提供过帮助和做出过贡献的个人或集体,均已在文中作了明确的说明并表示了谢意。

作 者 签 名: 日 期: 指导教师签名: 日 期:

使用授权说明

本人完全了解 大学关于收集、保存、使用毕业设计(论文)的规定,即:按照学校要求提交毕业设计(论文)的印刷本和电子版本;学校有权保存毕业设计(论文)的印刷本和电子版,并提供目录检索与阅览服务;学校可以采用影印、缩印、数字化或其它复制手段保存论文;在不以赢利为目的前提下,学校可以公布论文的部分或全部内容。

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