目录一、摘要………………………………………………………………3二、正文………………………………………………………………31、引言……………………………………………………………32、系统设计方案…………………………………………………42.1超声波测距的原理………………………………………42.2设计框图…………………………………………………42.3US-100超声波收发模块…………………………………42.4单片机电路………………………………………………62.5蜂鸣器报警电路…………………………………………82.6显示电路…………………………………………………92.7供电及程序下载电路……………………………………103软件编程………………………………………………………103.1软件流程图………………………………………………103.2主程序……………………………………………………114、下载调试………………………………………………………195、实物图…………………………………………………………196元件选择………………………………………………………20三、总结………………………………………………………………20四、参考文献…………………………………………………………20一、摘要超声波具有指向性强,能量消耗缓慢,传播距离较远等优点,所以,在利用传感器技术和自动控制技术相结合的测距方案中,超声波测距是目前应用最普遍的一种,它广泛应用于防盗、倒车雷达、水位测量、建筑施工工地以及一些工业现场。本设计详细介绍了超声波传感器的原理和特性,分析了超声波测距的原理的基础上,指出了设计测距系统的思路和所需考虑的问题,给出了以STC89c52单片机为核心的低成本、高精度、微型化数字显示超声波测距仪的硬件电路和软件设计方法。该系统电路设计合理、工作稳定、性能良好、检测速度快、计算简单、易于做到实时控制,并且在测量精度方面能达到工业实用的要求。关键词:超声波单片机测距STC89c52AbstractUltrasonicwavehasstrongpointingtonature,slowlyenergyconsumption,propagatingdistancefarther,so,inutilizingtheschemeofdistancefindingthatsensortechnologyandautomaticcontroltechnologycombinetogether,ultrasonicwavefindsrangetousethemostgeneraloneatpresent,itappliestoguardagainsttheft,movebackwardtheradar,waterlevelmeasuring,buildingconstructionsiteandsomeindustrialscenesextensively。Thissubjecthasintroducedprincipleandcharacteristicoftheultrasonicsensorindetail,onthebasisofanalyzingprinciplethatultrasonicwavefindsrange,thesystematicthinkingandquestionsneededtoconsiderthathavepointedoutthatdesignsandfindsrange,providelowcost,thehardwarecircuitofhighaccuracy,ultrasonicrangefinderofminiaturedigitaldisplayandsoftwaredesignmethodtakingSTC89c52asthecore,thiscircuitofsystemisreasonableindesign,workingstability,performancegoodmeasuringspeedingsoon,calculatingsimple,apttoaccomplishreal-timecontrol,andcanreachindustry'spracticaldemandinmeasuringtheprecision。KeyWords:Ultrasonicwave;One-chipcomputer;Rangefinding;STC89c52二、正文1、引言:测量距离的方法有很多种,短距离的可以用米尺,远距离的有激光测距等,超声波测距适用于高精度的中长距离测量。因为超声波在标准空气中的传播速度为331.45米/秒,由单片机负责计时,系统的测量精度理论上可以达到毫米级。2、系统设计方案12.1超声波测距的原理超声波测距的原理一般采用渡越时间法TOF(timeofflight),也可以称为回波探测法,如图所示。超声波发射器向某一方向发射超声波,在发射时刻的同时开始计时,超声波在介质中传播,途中碰到障碍物就立即返回来,超声波接收器收到反射波就立即停止计时。根据传声介质的不同,可分为液介式、气介式和固介式三种。根据所用探头的工作方式,又可分为自发自收单探头方式和一发一收双探头方式。而倒车雷达一般是装在车尾,超声波在空气中传播,超声波在空气中(20℃)的传播速度为340m/s(实...