【正文】
p。 SCL=1。 } void start()///////啟動信號 { SDA=1。 } void display_m(uchar m)//////顯示儲存的序號 { write(0x80+0x40+14,0)。 write(0x80+0x40,0)。 } void text_time_display(uint a) //////測試次數(shù)顯示函數(shù) 河南工程學(xué)院畢業(yè)設(shè)計 32 { write(0x80+10,0)。 } void begin2_display()////開機顯示 Tel:13312912925 : { write(0x80,0)。 write(0x80,0)。 河南工程學(xué)院畢業(yè)設(shè)計 31 E=1。 RW=1。 delay(15)。 char s,c,i=1,m[10]。 //1602 的使能端 sbit BF=P0^7。 河南工程學(xué)院畢業(yè)設(shè)計 25 參考文獻 [1] 吳金戌 . 沈慶陽 . 郭庭 . 《 8051 單片機實踐與應(yīng)用》 , 清華大學(xué)出版社 , 2021 年 4 月版 ; [2] 李建忠 . 《單片機原理及應(yīng)用》 , 西安電子科技大學(xué)出版社 , 2021 年版 ; [3] 張金鐸 . 《傳感器用其應(yīng)用》 , 西安電子科技大學(xué)出版社 , 2021 年版 ; [4] 求是科技 . 《單片機典型外圍器件及應(yīng)用實例》 , 人民郵電出版社 , 2021 年版 ; [6] 應(yīng)崇福 . 《超聲學(xué)》 , 北京科學(xué)出版社 1990 年版 ; [7] 甕嘉民 . 單片機應(yīng)用開發(fā)技術(shù) — 基于 PROTEUS 仿真和 C 語言編程,中國電力出版社, 2021 年版 ; 河南工程學(xué)院畢業(yè)設(shè)計 26 附錄 附錄 1 系統(tǒng)原理圖 河南工程學(xué)院畢業(yè)設(shè)計 27 附錄 2 系統(tǒng) PCB 圖 河南工程學(xué)院畢業(yè)設(shè)計 28 附錄 3 系統(tǒng)程序 ///////////////////////////////////////////////////////////// ////////河南工程學(xué)院 //電氣信息工程系 //微電子技術(shù) ///////////// //////// 超聲波測距 ///張曉光 /////2021 年 5 月 ////////////////// ///////////////////////////////////////////////////////////// include define uchar unsigned char define uint unsigned int 河南工程學(xué)院畢業(yè)設(shè)計 29 sbit WP =P1^0。時 ,系統(tǒng)測量到的距離是障礙物與換能器之間的距離而不是和測量參考平面之間的距離 ,這就會造成測量誤差。 respons()。 } uchar read_add(uchar address)//指定地址讀一個字節(jié)數(shù)據(jù) { uchar dd。 } void write_add(uchar address,uchar date)//指定地址寫一個字節(jié)數(shù)據(jù) { 河南工程學(xué)院畢業(yè)設(shè)計 21 start()。 delay(5)。 WP=0。 SDA=CY。 } void writebyte(uchar date)/////寫一個字節(jié) { uchar i,temp。 } void respons()////////回應(yīng)信號 { uchar i=0。 SDA=0。 SCL=1。每個接到 I2C 總線上的器件都有唯一的地址。 } /////////////////////////////////////////////////////////////////////////// 四、數(shù)據(jù)存儲電路及程序 系統(tǒng)提供 M1M9總共 9個數(shù)據(jù)保存, key2 鍵是上翻 M1M9, key3 鍵是下翻 M1M9, key1鍵是測距鍵,每當(dāng)按下 key1 鍵,系統(tǒng)測距一次,測距后的數(shù)據(jù)保存在當(dāng)前液晶顯示的 M單元(上下鍵選擇)中,系統(tǒng)可以顯示用戶開機后總共的測距次數(shù),本系統(tǒng)還提供了開機或復(fù)位后,系統(tǒng)自動的跳轉(zhuǎn)到關(guān)機前狀態(tài)。c++)write(result[c+16],1)。 write(0x30+(a%10),1)。c++)write(begin2[c],1)。c++)write(begin1[c],1)。 } void init1602() ////////1602 初始化程序 { write(0x38,0)。 E=0。并且 1602 可以顯示更多的字符,可以更加直觀的讓用戶了解系統(tǒng)的相關(guān)參數(shù),方便于用戶的操作。 Trig=0。 注意事項:測距時,被測物體的面積不少于 平方米且盡量要求平整,否則影響測量結(jié)果。測試距離 =(高電平時間 *聲速) /2 ; 實物如下圖所示 。 write(0x72,1)。 } if(key(exam)) ///測試距離 { text()。 display_s(m[i])。 for(c=0。c5。然后系統(tǒng)提供用 24c02 保存測試數(shù)據(jù),用 1602 顯示測試數(shù)據(jù)和測試次數(shù)。 超聲波測距系統(tǒng)的一般結(jié)構(gòu)如圖 31所示。本設(shè)計采用往返時間檢測法測距。電氣方式包括壓電型、磁致伸縮型和電動型 等;機械方式有加爾統(tǒng)笛、液哨和氣流旋笛等。與傳統(tǒng)超聲技術(shù)完全不同,新的 超聲技術(shù)具有以下特點:在不破壞媒質(zhì)特性的情況下實現(xiàn)非接觸性測量,環(huán)境適應(yīng)能力強,可實現(xiàn)在線測量。超聲波與一般聲波比較,它的振動頻率高,而且波長短,因而具有束射特性,方向性強,可以定向傳播,其能量遠遠大于振幅相同的一般聲波,并且具有很高的穿透能力。超聲波測距系統(tǒng),就是為機器人了解其前方、左側(cè)和右側(cè)的環(huán)境而提供一個運動距離信息。超聲波測距相對其他測距技術(shù)而言成本低廉 ,測量精度較高 ,不受環(huán)境的限制 ,應(yīng)用方便,將它與紅外、灰度傳感器等結(jié)合共同實現(xiàn)機器人尋線和繞障功能。對于測距系統(tǒng)的一些主要參數(shù)進行了討論。 關(guān)鍵詞: 超聲波 測距 AT89S52 E2PROM 河南工程學(xué)院畢業(yè)設(shè)計 2 Abstract With the rapid development of science and technology, ultrasonic sensor will be used more and more , the present level of technology, people can use the specific sensor technology is also very limited, it is a booming and there are unlimited prospects for technical and industrial ahead, the ultrasonic sensor is very important as a new useful tool in all aspects will have a huge space for development, it will be more towards the direction of high positioning accuracy to meet the growing needs of the munity, such as the Audioaccept the basic trends are: development of a higher positioning accuracy of passive ranging sonar, underwater weapons, in order to meet the needs of all covert attacks。但就目前技術(shù)水平來說,人們可以具體利用的傳感技術(shù)還十分有限,因此,這是一個正在蓬勃發(fā)展而又有無限前景的技術(shù)及產(chǎn)業(yè)領(lǐng)域。 effort to reduce the submarine from the noise and improve the working environment of submarine is no doubt that the future automation of ultrasonic sensors and intelligent integration with other sensor integration and fusion, the formation of technological advances in sensors, sensor development from a simple function to determine a learning function and, ultimately, to be the new century, new look of the sensor will play a bigger role. Key words: Ultrasonic Wave Distance Measuring AT89S52 E2PROM 河南工程學(xué)院畢業(yè)設(shè)計 3 目 錄 前 言 ............................................................................................................................................. 1 第一章 超聲波測距概述 ...................................................................................................... 2 第二節(jié) 超聲波檢測的發(fā)展 .................................................................................................. 2 第二節(jié) 超聲波測距特性 ............................................................................................