【正文】
波,且持續(xù)發(fā)射 200ms。 超聲波的接收與處理 接收頭采用與發(fā)射頭配對(duì)的 UCM40R,將超聲波調(diào)制脈沖變?yōu)榻蛔冸妷盒盘?hào),經(jīng)運(yùn)算放大器 IC1A 和 IC1B 兩極放大后加至 IC2。調(diào)節(jié) R8 在發(fā)射的載頻上,則 LM567 輸入信號(hào)大于 25mV,輸出端 8腳由高電平躍變?yōu)榈碗娖?,作為中斷?qǐng)求信號(hào),送至單片機(jī)處理 。部分源程序如下: receive1: push psw push acc clr ex1 ; 關(guān)外部中斷 1 jnb , right ; 引腳為 0,轉(zhuǎn)至右測(cè)距電路中斷服務(wù)程序 jnb , left ; 引腳為 0,轉(zhuǎn)至左測(cè)距電路中斷服務(wù)程序 return: SETB EX1; 開(kāi)外部中斷 1 pop acc pop psw reti right: ... ; 右測(cè)距電路中斷服務(wù)程序入口 ajmp return left: ... ; 左測(cè)距電路中斷服務(wù) 程序入口 ajmp return 計(jì)算超聲波傳播時(shí)間 在啟動(dòng)發(fā)射電路的同時(shí)啟動(dòng)單片機(jī)內(nèi)部的定時(shí)器 T0,利用定時(shí)器的計(jì)數(shù)功能記錄超聲波發(fā)射的時(shí)間和收到反射波的時(shí)間。其部分源程序如下: RECEIVE0: PUSH PSW PUSH ACC CLR EX0 ; 關(guān)外部中斷 0 MOV R7, TH0 ; 讀取時(shí)間值 MOV R6, TL0 CLR C MOV A, R6 SUBB A, 0BBH; 計(jì)算時(shí)間差 MOV 31H, A ; 存儲(chǔ)結(jié)果 MOV A, R7 SUBB A, 3CH MOV 30H, A SETB EX0 ; 開(kāi)外部中斷 0 POP ACC POP PSW RETI 對(duì)于一個(gè)平坦的目標(biāo),距離測(cè)量包括兩個(gè)階段 :粗糙的測(cè)量和精細(xì)測(cè)量。 第二步:根據(jù)公式改變回波放大器的獲得量直到回?fù)鼙粰z測(cè)到。 第四步:設(shè)置回波放大器的所得來(lái)規(guī)格輸出,假定是 3伏。根據(jù)第二部的數(shù)據(jù)設(shè)定時(shí)間窗。測(cè)量過(guò)零時(shí)間與回波的振幅。 第六步:通過(guò)公式計(jì)算距離 y。主程序完成初始化工作、各路超聲波發(fā)射和接收順序的控制。 系統(tǒng)初始化后就啟動(dòng)定時(shí)器 T1從 0開(kāi)始計(jì)數(shù),此時(shí)主程序進(jìn)入等待,當(dāng)?shù)竭_(dá)定時(shí)時(shí)間時(shí) T1 溢出進(jìn)入 T1 中斷服務(wù)子程序;在 T1 中斷服務(wù)子程序中將啟動(dòng)一次新的超聲波發(fā)射,此時(shí)將在 引腳上開(kāi)始產(chǎn)生 kHz40 的方波,同時(shí)開(kāi)啟定時(shí)器T0計(jì)時(shí),為了避免直射波的繞射,需 要延遲 1ms 后再開(kāi) INT0 中斷允許; INT0 中斷允許打開(kāi)后,若此時(shí)出現(xiàn)低電平則代表收到回波信號(hào),將提出中斷請(qǐng)求進(jìn)入 INT0中斷服務(wù)子程序,在 INT0 中斷服務(wù)子程序中將停止定時(shí)器 T0 計(jì)時(shí),讀取定時(shí)器 T0時(shí)間值到相應(yīng)的存儲(chǔ)區(qū),同時(shí)設(shè)置接收成功標(biāo)志;主程序一旦檢測(cè)到接收成功標(biāo)志,將調(diào)用測(cè)溫子程序,采集超聲波測(cè)距時(shí)的環(huán)境溫度,并換算出準(zhǔn)確的聲速,存儲(chǔ)到RAM存儲(chǔ)單元中;單片機(jī)再調(diào)用距離計(jì)算子程序進(jìn)行計(jì)算,計(jì)算出傳感器到目標(biāo)物體之間的距離;此后主程序調(diào)用顯示子程序進(jìn)行顯示;當(dāng)一次發(fā)射、接收、顯示的過(guò)程完成后,系統(tǒng)將延 遲 100ms 重新讓 T1 置初值,再次啟動(dòng) T1以溢出,進(jìn)入下一次測(cè)距。 五、結(jié)論 對(duì)所要求測(cè)量范圍 30cm~200cm 內(nèi)的平面物體做了多次測(cè)量發(fā)現(xiàn),其最大誤差為 ,且重復(fù)性好。因此,它不僅可用于移動(dòng)機(jī)器人,還可用在其它檢測(cè)系統(tǒng)中。 附件 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