【文章內(nèi)容簡介】
BB A, 3CH MOV 30H, A SETB EX0 ; 開外部中斷 0 POP ACC POP PSW RETI 對于一個平坦的目標,距離測量包括兩個階段 :粗糙的測量和精細測量。 第一步:脈沖的傳送產(chǎn)生一種簡單的超聲波。 第二步:根據(jù)公式改變回波放大器的獲得量直到回撥被檢測到。 第三步:檢測兩種回波的振幅與過零時間。 第四步:設(shè)置 回波放大器的所得來規(guī)格輸出,假定是 3伏。通過脈沖的周期設(shè)置下一個脈沖。根據(jù)第二部的數(shù)據(jù)設(shè)定時間窗。 第五步:發(fā)射兩串脈沖產(chǎn)生干擾波。測量過零時間與回波的振幅。如果逆向發(fā)生在回波中,決定要不通過在低氣壓插入振幅。 第六步:通過公式計算距離 y。 四、超聲波測距系統(tǒng)的軟件設(shè)計 軟件分為兩部分,主程序和中斷服務(wù)程序,如圖 3( a)( b) (c) 所示。主程序完成初始化工作、各路超聲波發(fā)射和接收順序的控制。 定時中斷服務(wù)子程序完成三方向超聲波的輪流發(fā)射,外部中斷服務(wù)子程序主要完成時間值的讀取、距離計算、結(jié)果的輸出等工作 。 系統(tǒng)初始化后就啟動定時器 T1 從 0開始計數(shù),此時主程序進入等待,當?shù)竭_定時時間時 T1 溢出進入 T1 中斷服務(wù)子程序;在 T1 中斷服務(wù)子程序中將啟動一次新的超聲波發(fā)射,此時將在 引腳上開始產(chǎn)生 40KHz 的方波,同時開啟定時器 T0計時,為了避免直射波的繞射,需要延遲 1ms 后再開 INT0 中斷允許; INT0 中斷允許打開后,若此時出現(xiàn)低電平則代表收到回波信號,將提出中斷請求進入 INT0 中斷服務(wù)子程序,在 INT0 中斷服務(wù)子程序中將停止定時器 T0計時,讀取定時器 T0 時間值到相應(yīng)的存儲區(qū),同時設(shè)置接收成功標志;主程序一旦 檢測到接收成功標志,將調(diào)用測溫子程序,采集超聲波測距時的環(huán)境溫度,并換算出準確的聲速,存儲到 RAM 存儲單元中;單片機再調(diào)用距離計算子程序進行計算,計算出傳感器到目標物體之間的距離;此后主程序調(diào)用顯示子程序進行顯示;當一次發(fā)射、接收、顯示的過程完成后,系統(tǒng)將延遲 100ms 重新讓 T1置初值,再次啟動 T1 以溢出,進入下一次測距。如果由于障礙物過遠,超出量程,以致在 T0溢出時尚未接收到回波,則顯示 “ERROR” 重新回到主流程進入新一輪測試。 五、結(jié)論 對所要求測量范圍 30cm~200cm 內(nèi)的平面物體做了多次測量發(fā)現(xiàn) ,其最大誤差為,且重復(fù)性好??梢娀趩纹瑱C設(shè)計的超聲波測距系統(tǒng)具有硬件結(jié)構(gòu)簡單、工作可靠、測量誤差小等特點。因此,它不僅可用于移動機器人,還可用在其它檢測系統(tǒng)中。 思考:至于為什么接收不用晶體管做放大電路呢,因為放大倍數(shù)搞不好, CX20206 集成放大電路,還帶自動電平增益控制,放大倍數(shù)為 76dB,中心頻率是 38k 到 40k,剛好是超聲波傳感器的諧振頻率 。 附件 2:外文原文 (復(fù)印件) Ultrasonic distance meter Document Type and Number:United States Patent 5442592 Abstract:An ultrasonic distance meter cancels out the effects of temperature and humidity variations by including a measuring unit and a reference unit. In each of the units, a repetitive series of pulses is generated, each having a repetition rate directly related to the respective distance between an electroacoustic transmitter and an electroacoustic receiver. The pulse trains are provided to respective counters, and the ratio of the counter outputs is utilized to determine the distance being measured. Publication Date:08/15/1995 Primary Examiner:Lobo, Ian J. OF THE INVENTION This invention relates to apparatus for the measurement of distance and, more particularly, to such apparatus which transmits ultrasonic waves between two points. Precision machine tools must be calibrated. In the past, this has been acplished utilizing mechanical devices such as calipers, micrometers, and the like. However, the use of such devices does not readily lend itself to automation techniques. It is known that the distance between two points can be determined by measuring the propagation time of a wave travelling between those two points. One such type of wave is an ultrasonic, or acoustic, wave. When an ultrasonic wave travels between two points, the distance between the two points can be measured by multiplying the transit time of the wave by the wave velocity in the medium separating the two points. It is therefore an object of the present invention to provide apparatus utilizing ultrasonic waves to accurately measure the distance between two points. When the medium between the two points whose spacing is being measured is air, the sound velocity is dependent upon the temperature and humidity of the air. It is therefore a further object of the,present invention to provide apparatus of the type described which is independent of temperature and humidity variations. OF THE INVENTION The foregoing and additional objects are attained in accordance with the principles of this invention by providing distance measuring apparatus which includes a reference unit and a measuring unit. The reference and measuring units are the same and each includes an electroacoustic transmitter and an electroacoustic receiver. The spacing between the transmitter and the receiver of the reference unit is a fixed reference distance, whereas the spacing between the transmitter and receiver of the measuring unit is the distance to be measured. In each of the units, the transmitter and receiver are coupled by a feedback loop which causes the transmitter to generate an acoustic pulse which is received by the receiver and converted into an electrical pulse which is then fed back to the transmitter, so that a repetitive series of pulses results. The repetition rate of the pulses is inversely related to the distance between the transmitter and the receiver. In each of the units, the pulses are provided to a counter. Since the reference distance is known, the ratio of the counter outputs is utilized to determine the desired distance to be measured. Since both counts are identically influenced by temperature and humidity variations, by taking the ratio of the counts, the resultant measurement bees insensitive to such variations. DESCRIPTION of ultrasonic distance measurement 1, the principle of piezoelectric ultrasonic generator Piezoelectric ultrasonic generator is the use of piezoelectric crystal resonators to work. Ultrasonic generator, the internal structure as shown in Figure 1, it has two piezoelectric chip and a resonance