超声波自动测量物体液位系统的设计(任务书,毕业论文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