摘 要 学 号:
毕业设计说明书
GRADUATE DESIGN
设计题目:基于单片机的智能交通灯控制系统的设计
学 院:电气工程学院
-I-
大学信息学院 摘 要
随着现代社会对交通运输的日趋依赖,交通灯成为了人们生活中不可或缺的一部分。传统的交通灯控制系统虽然在一定程度上可以满足指挥路口交通的需要,但随着城市规模的不断扩大,原有的交通灯控制系统已经表现出明显的缺点:红绿灯时间相对固定,不能伴随车流量的改变而调整红绿灯的显示时间。
本设计以AT89S51单片机为核心,外接外围电路构成基本电路,使硬件电路能适应所完成的控制功能。在Keil软件中编写C语言程序,最后用Proteus软件进行仿真,基本实现了智能交通灯的模拟。该系统可控制红、绿、黄灯按时间依次变换,并有倒读秒功能。在此基础上,通过传感器对车流量的情况进行数据采集。将采集的数据传送给控制中心,进行分析比较。根据比较的结果,将具体的车流量转换成两相位车流量大小的比值。根据比值转换成对红绿灯时间的控制,使交通信号灯时间可根据车流量改变,提高了交叉口的通行效率。
关键词:单片机;交通灯;倒计时显示;传感检测
-II-
目 录 Abstract
As modern society increasingly rely on for transportation, traffic lights has become the indispensable part of people's life. Although to some extent, the traditional traffic light control system can meet the needs of command intersection traffic, but with the enlargement of city scale, the original traffic light control systems have shown obvious disadvantages: traffic light time is relatively fixed, not along with the change of the flow adjustment of traffic lights show time.
This design uses AT89S51 microcontroller as the core, constitute the basic circuit, external peripheral circuit that can be adapted to control the functions performed by hardware circuit. In Keil software written in C language program, and finally with the Proteus software simulation, the basic realization of the intelligent simulation of traffic lights. The system can control red, green, yellow light according to time, in turn, transform, and has function of seconds. On this basis, through the sensor to the situation of traffic data collection. Will collect the data transmitted to the control center, carries on the analysis comparison. According to the result of comparison, the specific traffic into two phase flow is the ratio of the size. Translated into traffic lights time according to the ratio control, make the traffic lights time may be changed according to the number of cars, improving the efficiency of the intersection traffic.
Key words: single chip microcomputer; The traffic light; The countdown display;
Sensing detection
-III-
目录 目 录
摘 要 ............................................................. II Abstract .......................................................... III 第1章 绪论 ......................................................... 1
1.1 课题背景 .................................................... 1 1.2 课题研究的意义 .............................................. 2 1.3 智能交通灯的研究背景 ........................................ 2 1.4 国内外研究现状 .............................................. 3 1.5 我国交通灯现状 .............................................. 3 1.6 论文结构 .................................................... 4 第2章 智能交通灯控制系统方案设计 ................................... 5
2.1 智能交通灯控制系统的通行方案设计 ............................ 5 2.2 智能交通灯控制系统的功能要求 ................................ 6 2.3 智能交通灯控制系统的基本构成及原理 .......................... 7 2.4 本章小结 .................................................... 7 第3章 系统硬件电路的设计 ........................................... 8
3.1 主要硬件的选型 .............................................. 8
3.1.1 单片机的选型 .......................................... 8 3.1.2 车流量检测传感器的选型 ................................ 8 3.1.3 电源电路的选型 ....................................... 10 3.2 系统硬件总电路构成及原理 ................................... 10
3.2.1 系统硬件电路构成 ..................................... 10 3.2.2 系统工作原理 ......................................... 11 3.3 AT89S51单片机简介 .......................................... 12
3.3.1 单片机的概述 ......................................... 12 3.3.2 AT89S51主要引脚功能 ................................. 12 3.3.3 AT89S51芯片最小系统 ................................. 15 3.4 车流量检测模块介绍 ......................................... 16
3.4.1 光电开关的工作原理 ................................... 17 3.4.2 光电开关的分类 ...................................... 17 3.4.3 光电开关的应用 ....................................... 18 3.5 其它硬件介绍 ............................................... 19
3.5.1 发光二极管 ........................................... 19 3.5.2 七段LED 数码管 ...................................... 19 3.5.3 电源电路设计 ......................................... 20 3.5.4 蜂鸣器 ............................................... 21 3.6 本章小结 ................................................... 21 第4章 软件设计 .................................................... 23
4.1 主程序设计 ................................................. 23 4.2 车流量采样程序设计 ......................................... 23 4.3 显示程序设计 ............................................... 27 4.4 理论基础知识 ............................................... 27
4.4.1 定时器原理 ........................................... 27
-IV-
目 录 4.4.2 软件延时原理 .......................................... 28 4.5 本章小结 ................................................... 28 第5章 智能交通灯的仿真 ............................................ 29
5.1 Proteus软件介绍 ............................................ 29 5.2 仿真过程介绍 ............................................... 29
5.2.1 用PROTEUS绘制原理图 .................................. 29 5.2.2 PROTEUS对单片机内核的仿真 ............................ 30 5.2.3 仿真结果与分析 ........................................ 31 5.3 本章小结 ................................................... 37 结束语 ............................................................. 38 参考文献 ........................................................... 39 谢 辞 ............................................................. 40 附 录 ............................................................. 41
-V-