摘要:超声波是一种指向性强,能量消耗缓慢,在介质中传播距离较远的声波,因此在测距时不受光线、电磁波、粉尘等因素的影响,且成本低,速度快,检测元件可以不与被测介质接触,可测范围广,安装维护方便等,所以应用非常广泛。本设计是以单片机技术为基础,实现对前方物体距离的测量。该系统设计主要由主控制器模块、超声波发射模块、超声波接收模块和显示模块等四个基本模块构成。本设计利用两个中断,在发射信号时,打开定时器中断0和外部中断0使定时器计时,接收到发射超声波信号时,外部中断0关闭中断,这时定时器中断0计录的时间就为超声波传播经过测距仪到前方物体的来回时间,经过单片机处理得到距离值S并且通过显示器显示出来。此系统具有易控制、工作可靠,测距精度高的优点。60889
毕业论文关键词:单片机,超声波传感器,显示器
Abstract: Ultrasonic is a kind of strong directivity, energy consumption slow, in the medium distance transmission of sound waves, So it is not affected by factors such as light, electromagnetic waves, dust and so on when it was used to measure the distance. Besides that, with the low cost, fast speed, detecting element can not contact with the measured medium, measurable range, easy installation and maintenance, etc., so the application is very broad. This design is based on single chip microcomputer technology, realizes the measurement of the front object distance. The system design is mainly composed of main controller module, ultrasonic launch module, ultrasonic receiving module and display module and so on four basic modules, with a receiving part receiving ultrasound. This design uses two interrupts, when transmitting, open the timer interrupt 0 timer and external interrupt 0 timer, receives the side of launch ultrasonic wave signal, the external interrupt 0 closed interrupted, then the timer interrupt 0 meter to record the time for the ultrasonic propagation through the range finder to the object in front of the time back and forth. And the result is treated with single chip microcomputer distance values S and through the display.This system is easy to control, reliable operation and with the advantage of high ranging accuracy.
Keywords: single chip microcomputer, ultrasound sensor, display
1 绪论 4
1.1选题的背景及研究意义 4
1.2超声波测距的发展趋势 4
2 超声波测距系统总体设计 5
2.1超声波测距系统设计的目的和要求 5
2.2 超声波测距系统的工作原理 5
3 超声波测距系统硬件设计 6
3.1 AT89S52单片机的概述 6
3.2 LCD1602液晶显示器 6
3.2.1 LCD1602模块的结构 7
3.2.2 LCD1602与单片机的连接方式 7
3.3 HC-SR04超声波测距模块 8
3.4 系统设计 9
4 超声波测距系统软件设计 9
4.1系统设计超声波测距仪的算法设计 10
4.2 主程序流程图 10
4.3 超声波发生子程序和超声波接收中断程序 11
5 超声波测距模块测试 11
结论 13