超聲波自動測量物體液位系統的設計(任務書,畢業論文15000字)
摘要
本系統以STC89C52單片機為核心,通過硬件電路連接和軟件程序的編寫實現通用型超聲波自動測量物體液位系統的設計。其主要原理是由單片機控制超聲波發射電路發射超聲波,超聲波接收電路接收遇到液面后反射回來的超聲波回波,單片機計時所用時間, 將測得時間帶入相應公式,即可求得當前液位;利用按鍵可以手動設置容器深度,也可以在容器為空時自動測量出容器深度,達到通用型液位檢測儀的設計;DS18B20測溫模塊實現當前空氣溫度的測量;最后通過LCD12864液晶不斷更新顯示當液位與溫度。若液位超出預設的最高值,同時LED亮起報警。
硬件部分包括STC89C52單片機,超聲波測距部分, LCD12864液晶顯示部分,DS18B20測溫部分,按鍵部分和LED報警部分。軟件設計分為兩塊,主程序和中斷子程序。主程序完成初始化、超聲波發射和接收,距離計算、時間值的讀取,結果顯示等工作,中斷服務子程序主要完成報警工作。
關鍵詞:超聲波測距;單片機;液位測量;溫度補償;通用型測液位系統
Abstract
This system use STC89C52 microcontroller as the core, through a combination of hardware and written of software program, achieve the design of general type liquid level measurement system. The main principle is controlled by the microcontroller ultrasonic transmitter circuit launch ultrasound and receives the echo reflected surface encountered while recording the time used microcontroller. Take the measured time into the appropriate formula to obtain the current level. We can set the depth of the container by keys. It is also very convenient to automatically measure the depth of containers by pressing a key when the containers are empty. So that, we can achieve a general type liquid level measurement system. The DS18B20 module can test the current temperature, and put the measured temperature into the temperature compensation formula can making the measurement more accurate results. Last updated through the LCD liquid crystal display the current level and the temperature. If the level exceeds the preset maximum value, LED display a warning red light alarm.
STC89C52 microcontroller hardware including, ultrasonic distance measuring module, LCD12864 module, DS18B20 temperature test module, keys module and the LED alarm module. Software design is divided into two parts, the main program and interrupt service routine. Main program to initialize, transmit and receive ultrasound, distance calculation, get the time and the results display most of the major work. Interrupt service routine mainly finish the work of alrm.
Key words: Ultrasonic distance measurement; SCM; liquid level measurement; Temperature Compensation; Universal liquid level measurement system
目錄
第一章 ?緒論1
1.1 課題的意義和背景1
1.2 液位測量系統的現狀1
1.3 國內外液位監測技術的發展方向和發展現狀2
1.4 本章小結3
第二章 ?超聲波測液位系統4
2.1 超聲波與超聲波傳感器4
2.2 超聲波測液位原理4
2.2.1 超聲波測距原理4
2.2.2 超聲波測液位原理5
2.3 總體方案設計6
2.4 本章小結6
第三章 ?硬件系統設計7
3.1 單片機系統7
3.1.1 單片機系統概述7
3.1.2 STC89C52單片機7
3.2 發射電路比較10
3.3 接收電路比較11
3.4 超聲波模塊13
3.4.1 超聲波模塊工作原理與特點13
3.4.2 超聲波模塊內部結構與工作時序14
3.5 LCD12864液晶顯示模塊16
3.6 溫度測量模塊17
3.7 報警模塊18
3.8 按鍵設置模塊19
3.9 系統電路連接19
3.10 本章小結20
第四章 ?軟件系統設計21
4.1 總體設計思想21
4.2 系統主程序22
4.3 溫度補償子程序22
4.4 基于LCD12864的顯示子程序23
4.5 按鍵設置子程序24
4.6 基于DS18B20的測溫子程序26
4.7 報警子程序27
4.8 本章小結27
第五章 ?系統調試分析28
5.1 硬件調試28
5.2 故障問題解決28
5.3 實驗數據29
5.4 誤差分析30
結論31
參考文獻32
致謝33