单片机课程设计
单片机课程设计
题 目 : 超声波测距的设计 班 级 : __ 指导老师: __________
姓 名: 学 号: 姓 名: 学 号: 姓 名: 学 号: 姓 名: 学 号:
单片机课程设计
目 录
摘要 ··············································································································· 2 关键词 ············································································································ 2 一、 设计要求 ································································································· 2 二、 设计思想 ································································································· 2 三、 总体设计及说明 ························································································ 3
3.1超声波 ································································································· 3
3.1.1超声波特性及应用 ·········································································· 3 3.1. 2超声波发生器(换能器) ······························································ 3 3.1.3超声波测距原理 ··········································································· 4 3.2程序流程图 ··························································································· 5 3.3程序存储器和数据存储器的单元分配: ······················································ 6 四、 各部分电路设计与说明 ··············································································· 6
4.1超声波发射电路 ····················································································· 6 4.2数码管显示电路 ····················································································· 7 4.3单片机最小系统 ····················································································· 8 五、 整体电路图(仿真效果图) ········································································· 9 六、 设计总结 ································································································ 10 参考文献 ········································································································ 10 附表:组员分工及工作情况 ··············································································· 10 附录1:89C52芯片资料 ··················································································· 11 附录2:程序清单 ···························································································· 13
弟 1 页
单片机课程设计
超声波测距器的设计
贵州大学机械工程学院 农业机械化及其自动化 091班
作者:邹中妃0908030363 向冬冬0908030364 曾小军0908030395 蒙兆鹏0908030396
指导老师:张富贵 Email:374824671@qq.com
摘要 随着科学技术的快速发展,超声波在测距器中的应用越来越广。但就目前技术水平
来说,人们可以具体利用的测距技术还十分有限,因此,这是一个正在蓬勃发展而又有无限前景的技术及产业领域。展望未来,超声波测距器作为一种新型的非常重要有用的工具在各方面都将有很到的发展空间,它将朝着更加高定位高精度的方向发展,以满足日益发展的社会需求。毋庸置疑,未来的的超声波测距仪将与自动化智能化接轨,与其他的测距仪集成和融合,形成多测距仪。随着测距仪的技术进步,测距仪将从具有单纯判断功能发展到具有学习功能,最终发张到具有创造力。在新的世纪里,面貌一新的测距仪将发挥更大的作用。 因此,从基础出发,成功设计单片机控制的测距器是进一步研发新型智能测距仪的良好开端,也将是此类科技研发技术的基础与核心所在。此处,我们将进行基于89C52单片机(详细信息资料见附录1)的超声波测距器的设计。
关键词: 超声波 单片机 电路 程序 仿真
一、 设计要求
1. 设计一个超声波测距器,用于汽车倒车、建筑施工工地以及一些工业现场的位置控制。还可以用于液位、井深、管道长度、物体厚度等的测量。
2. 要求测量范围在0.10~4.00米,测量精度1厘米。
3. 测量时与被测物体无直接接触,能够清晰稳定地显示测量结果。
二、 设计思想
为了以超声波作为检测手段,必须产生超生波和接收超声波。完成这种功能的装置就是超声波传感器,习惯上称为超声波换能器或超声波探头。超声波传感器有发送器和接收器,但一个超声波传感器也可具有发送和接收声波的双重作用。超声波传感器是利用压电效应的原理将电能和超声波相互转化,即在发射超声波的时候,将电能转换,发射超声波;而在收到回波的时候,则将超声振动转换成电信号。
超声波测距的原理一般采用渡越时间法TOF(time of flight)。首先测出超声波从发射到遇到障碍物返回所经历的时间,再乘以超声波的速度就得到二倍的声源与障碍物之间的距离
测量距离的方法有很多种,短距离的可以用尺,远距离的有激光测距等,超声波测距适用于高精度的中长距离测量。因为超声波在标准空气中的传播速度为331.45米/秒,由单片机负责计时,单片机使用12.0M晶振,所以此系统的测量精度理论上可以达到毫米级。 由于超声波指向性强,能量消耗缓慢,在介质中传播距离远,因而超声波可以用于距离的测量。利用超声波检测距离,设计比较方便,计算处理也较简单,并且在测量精度方面也能达到要求。
超声波发生器可以分为两类:一类是用电气方式产生超声波,一类是用机械方式产生超声波。本课题属于近距离测量,可以采用常用的压电式超声波换能器来实现。
弟 2 页