1汽车防撞报警器的设计【摘要】本设计主要应用AT89S52作为控制核心,与显示器、驱动电路等相结合的系统。利用单片机AT89S52作为报警装置的控制器,能充分发挥AT89S52的数据处理和实时控制功能。使系统工作于最佳状态,提高系统的灵敏度。其优点是体积小、使用方便、硬件电路简单,软件功能完善,控制系统可靠,具有一定的使用和参考价值。该系统利用超声波实现对汽车的测距,利用单片机的实时控制和数据处理功能完成系统的控制。【关键词】单片机;AT89S52;超声波Designofautomotiveanti-collisionalarm【Abstract】ThedesignofthemainapplicationAT89S52asthecontrol,anddisplaydriverintegratedcircuitsandothersystems.MCUAT89S52usingthecontrollerasanalarmdevicethatcangivefullplaytoAT89S52ofdataprocessingandreal-timecontrolfunctions.Makethesystemworkinthebestcondition,improvethesystemsensitivity.Theadvantageissmall,easytouse,simplehardwarecircuit,software,functional,andreliablecontrolsystemhassomevalueinuseandreference.Theuseofultrasoundtoachievecollisionavoidancealarmonthecar'sdistance.Real-timecontrolofsingle-chipcomputeranddataprocessingfunctionstocompletecontrolofthesystem.【Keywords】SCM;AT89S52;Ultrasonic2目录第一章绪论····································································································41.1课题研究的背景和意义·········································································41.2汽车防撞报警器的发展现状···································································4第二章汽车防撞报警器的原理和总体设计·····························································72.1汽车防撞报警器的原理·········································································72.1.1压电式超声波传感器简介································································82.2汽车防撞报警器的总体设计方案·····························································9第三章硬件设计·····························································································103.1超声波发射模块与接收模块··································································103.3单片机控制系统···············································································113.4显示模块························································································12第四章软件设计·····························································································144.1软件的设计要求··················································································144.2软件设计的总体结构框图······································································144.3各个程序的流程图··············································································144.3.1主流程图···················································································154.3.2发射接收模块流程·······································································154.3.3中断程序流程·············································································164.4部分程序··························································································17第五章调试···································································································335.1测距模块的调试··················································································335.2调试结果····························································································345.3误差分析····························································································35第六章设计总结·····························································································376.1设计功能分析·····················································································376.2心得体会··························································································37致谢··············································································································38参考文献········································································································393附录一:汽车防撞报警器电路图·········································································40附录二:汽车防撞报警器PCB图········································································41附录三:所用元件清单·····················································································424第一章绪论随着我国社会经济的高速发展,交通运输业日益兴旺,汽车的数量逐渐增加。交通拥挤状况也日趋严重,撞碰车事件屡屡发生,造成了很大的人身伤亡和经济损失,汽车驾驶员也越来越担心车的安全了。针对这种情况,设计一种响应快,可靠性高且较为经济的汽车防撞报警系统势在必行,超声波测距法是最常见的一种距离测距方法,本设计介绍用AT89S52单片机控制的汽车防撞报警系统。该装置将单片机的实时控制及数据处理功能与超声波的测距技术、传感器技术相结合,可检测汽车运行中前方障碍物与汽车的距离及汽车车速。通过数字显示装置显示距离,并由发声电路根据距离远近情况发出警告声。1.1课题研究的背景和意义科技的飞速发展拉动了经济的飞跃,私家车逐渐走近了千家万户。但随着车辆的增加,停车难的问题也凸显出来。狭小的停车场地常常令有车一族感到苦恼,稍有不慎,车辆就可能与他人车辆或障碍物发生碰撞,造成损失。虽然车辆都有后视镜,但由于角度问题,不可避免的存在着后视盲区,并不能有效的解决碰撞问题。汽车防撞报警器是汽车倒车或者泊车时使用的安全辅助装置,它可以通过声音、灯光指示或是屏幕显示等手段告知驾驶者车辆周围的障碍物情况,令驾驶者及时调整车辆行进方向以便于规避,解除了驾驶者不便于直接目测与障碍物间距离的困扰,大大的提高了驾驶的安全性。可以说,汽车防撞报警器是车辆必不可少的应用设备之一。1.2汽车防撞报警器的发展现状通常,汽车防撞报警器由超声波传感器(俗称探头)、控制器和显示器(或蜂鸣器)等部分组成。汽车防撞报警器一般采用超声波测距原理,在控制器的控制下,由传感器发射超声波信号,当遇到障碍物时,产生回波信号,传感器接收到回波信号后经控制器进行数据处理、判断出障碍物的位置,由显示器显示距离并发出其他警示信号,得到及时警示,从而使驾驶者倒车时做到心中有数,使倒车变得更轻松。在几年的时间里,随着技术发展和用户需求的变化,汽车防撞报警器经过了大致六代的发展。第一代:倒车时通过喇叭提醒。当车辆倒车时会发出“倒车请注意”的提5醒声音,这就是汽车防撞报警器的第一代产品。现在只有小部分车辆还在使用。只要司机挂上倒档,它就会响起,提醒周围的人注意。从一定意义上说,它对驾驶者并没有直接的帮助,不是真正的汽车防撞报警器。它价格便宜,使用性能不高,已被市场淘汰。第二代:采用蜂鸣器不同声音提示驾驶员。这是汽车防撞报警器系统的真正开始。倒车时,如果车后1.8米-1.5米处有障碍物,蜂鸣器就会开始工作,发出警报声。蜂鸣声越急,表示车辆离障碍物越近。但由于没有语音提示,也没有距离显示,司机即使知道有障碍物,却不能确定障碍物离车有多远,对驾驶员帮助也不是太大。第三代:数码波段显示具体距离或者距离范围。这代产品比第二代进步很多,可以显示车后障碍物离车体的距离。如果是物体,在1.8米开始显示;如果是人,在0.9米左右的距离开始显示。这一代产品有两种显示