汽车倒车车距警报系统的设计
摘 要
本文介绍了一种基于STC89C52单片机控制的汽车倒车测距仪。采用超声波测距技术与单片机技术相结合,利用超声波传输中距离和时间的关系运算,STC89C52单片机计算出车后的障碍物与汽车尾部的距离,并通过数码显示车后的障碍物与汽车尾部的距离远近,实时发出报警信号,使驾驶员能时刻了解倒车时车后的环境并采取积极有效措施,从而大大提高了驾驶的安全性。
文章对总体设计思想进行了论述,分析了系统主要功能并以系统硬件设计框图的形式体现,进行了方案选择与方案论证。完成了硬件电路的设计,描述了各模块电路的组成,其中包括超声波发射电路、超声波接收电路、显示电路、蜂鸣器报警电路等,分析了电路中所用芯片的主要功能及各部分电路的工作原理。
本设计通过对各模块的硬件和软件的设计,基本能够达到设计要求,满足汽车倒车安全指标。
关键词:超声波;单片机;测距
II
Design of alarm system for car backing Abstract
This paper introduces a kind of auto reverse distance measuring instrument based on STC89C52 single chip microcomputer. By combining ultrasonic
distance measurement technology and single chip microcomputer technology, using relational operations on ultrasonic transmission distance and time,
STC89C52 microcontroller calculates the distance of obstacles and the rear of the car and car after the obstacle and the automobile tail distance through the digital display, real-time alarm signal, allows the driver to always understand when backing a car after the car and take positive and effective measures, thus greatly improving the safety of driving.
The overall design idea is discussed, the main function of the system is analyzed and the system hardware design block diagram is embodied. Completed the hardware circuit design, describes the composition of each module circuit, including ultrasonic transmitter circuit, ultrasonic receiving circuit, display circuit, a buzzer alarm circuit, the working principle of the chip used in the circuit mainly and the function of each part of the circuit is analyzed.
Through the design of the hardware and software of each module, this design can meet the design requirements, and can meet the requirements of the automobile reverse safety.
Key words: ultrasonic; single chip microcomputer; distance measurement
III
目 录
摘 要 ...................................................................................................................... II Abstract ....................................................................................... 错误!未定义书签。 第1章 绪论 ................................................................................................................. 1
1.1 课题研究的意义和背景 ................................................................................ 1 第2章 设计思想及方案论证 ..................................................................................... 2
2.1 方案选择 ........................................................................................................ 2
2.1.1 测距传感器模块 ................................................................................. 2 2.1.2 报警模块 ............................................................................................. 3 2.2 系统总体设计思想 ........................................................................................ 3 第3章 硬件电路设计 ................................................................................................. 4
3.1 超声波发射及接收电路设计 ........................................................................ 4
3.1.1 超声波的介绍 ..................................................................................... 4 3.1.2 超声波的特点 ..................................................................................... 4 3.1.3 超声波的应用 ..................................................................................... 4 3.1.4 超声波传感器 ..................................................................................... 5 3.1.5 超声波测距原理 ................................................................................. 5 3.1.6 超声波发射电路设计 ......................................................................... 7 3.1.7 超声波接收电路设计 ......................................................................... 7 3.1.8 HC-SR04超声波测距模块 ................................................................. 8 3.2 显示模块设计 .............................................................................................. 11 3.3 报警电路设计 .............................................................................................. 13 3.4 单片机控制电路设计 .................................................................................. 13
3.4.1 主控芯片STC12C56 ........................................................................ 13 3.4.2 时钟电路 ........................................................................................... 14 3.4.3 复位电路 ........................................................................................... 15
第4章 系统的软件设计 ........................................................................................... 16
4.1 主程序工作流程图 ...................................................................................... 16 第5章 硬件组装及调试 ........................................................................................... 19
5.1 硬件组装及调试 .......................................................................................... 19 5.2 误差原因分析 .............................................................................................. 19
I
第6章 结论 ............................................................................................................... 21 参 考 文 献 ............................................................................................................... 22 致 谢 ..................................................................................................................... 23 附录1 单片机整体电路原理图 ................................................................................ 24 附录2 超声波测距模块原理图 ................................................................................ 25 附录3 程序清单 ........................................................................................................ 26
II