单片机交通灯控制设计演示PPT
- 格式:ppt
- 大小:812.00 KB
- 文档页数:16
摘要随着经济发展,汽车数量急剧增加,城市道路日渐拥挤,交通拥塞已成为一个国际性的问题。
因此,设计可靠、安全、便捷的多功能交通灯控制系统有极大的现实必要性。
根据交通灯在实际控制中的特点,结合单片机的控制功能,提出了一种用单片机自动控制交通灯的简易方法。
设计中包括硬件电路的设计和程序设计两大步骤,对单片机学习中的几个重要内容都有涉足。
单片机的应用正在不断深入,单片机可以用来仿真各个系统。
在自动控制的单片机应用系统中,单片机往往作为一个核心部件来使用,仅单片机方面知识是不够的,还应根据具体硬件结构软硬件结合,加以完善。
十字路口车辆穿梭,行人熙攘,车行车道,人行人道,有条不紊。
那么靠什么来实现这井然秩序呢?靠的就是交通信号灯的自动指挥系统。
交通信号灯控制方式很多。
本系统采用单片机STC89C52为中心器件来设计交通灯控制器,实现了通过P1口设置红、绿灯燃亮时间的功能;红绿灯循环点亮,倒计时剩5秒时黄灯闪烁警示(交通灯信号通过P1口输出,显示时间通过P0口输出至双位数码管)。
本系统设计周期短、可靠性高、实用性强、操作简单、维护方便、扩展功能强。
关键词:单片机交通灯数码管Microcontroller to control traffic lights Abstract: With economic development, a sharp increase in the number of cars, increasingly crowded city roads, traffic congestion has become an international problem. Therefore, the design of reliable, safe, convenient and versatile traffic light control system of great practical necessity.According to the characteristics of the traffic lights in the actual control, combined with the microcontroller control functions, and easy with Auto Control traffic lights. The design includes two steps of the hardware circuit design and programming have to get involved in several important single-chip learning.The application of microcontroller is the deepening of the Microcontroller can be used to simulate systems. In the automatic control of microcomputer application system, the Microcontroller is often used as a core component to use only Microcontroller knowledge is not enough, but also according to the specific hardware architecture hardware and software, to be improved.Crossroads shuttle vehicles, pedestrians bustling Dealers lane, walkways, and orderly. Rely on to achieve this orderly order? Rely on automatic command system of traffic lights. Traffic signal control. The system uses the Microcontroller STC89C52-centric devices to design the traffic signal controller to achieve a set of red, green light to kindle through the P1 port function of time; traffic light cycle lights, countdown 5 seconds left flashing yellow warning (traffic light signals through the P1 the output port, and displays the time through the P0 port output to double-digit LED). The system design cycle, high reliability, practical, simple operation, easy maintenance, strong extensions.Key words:microcontroller traffic light digital tub目录第1章前言 (1)1.1交通灯发展概述 (1)1.2 课题背景及意义 (2)1.3课题任务及主要实现内容 (3)1.4 原理分析 (4)1.4.1交通灯显示时序的理论分析 (4)1.4.2 交通灯显示的理论分析 (5)第2章设计方案分析 (6)2.1 单片机与外围接口部件 (6)2.2 倒计时显示界面 (7)2.3 交通灯 (7)第3章硬件系统设计 (8)3.1 单片机的选择 (8)3.2 硬件电路实现 (11)3.2.1 最小系统设计 (11)3.2.2 显示设计 (13)3.2.3 发光二极管模拟红绿灯 (15)3.2.4 按键模块 (16)第4章软件电路设计 (17)4.1 软件编译环境测试 (17)4.1.1 C语言介绍 (17)4.1.2 Keil uVision4介绍 (17)4.2软件总体设计 (17)第5章电路检测 (21)结论 (24)致谢 (25)参考文献 (26)附录: (27)源程序: (29)第1章前言单片机微型计算机是微型计算机的一个重要分支,也是颇具生命力的机种。
1. 总体设计方案每15秒(可以更改)进行一次红绿等的转换,在绿灯变红灯的末3秒时,黄灯亮,亮3秒后黄灯灭,红灯亮,如此循环。
当出现紧急情况时,打开紧急情况开关,所有红灯亮。
该设计主要由如下部分组成:AT89S51单片机、复位电路、紧急情况电路、数码管显示电路、交通灯电路。
总体设计方案图如图1。
图1 总体方案设计图2. 单元模块设计系统整体硬件电路主要包括电源电路、复位电路、紧急情况电路、数码管显示电路、交通灯电路。
2.1电源电路图2 电源电路如图2电源可以输入直流,也可以输入交流电,输出均为稳定的直流电。
由USB接头输入电压,流过电桥进行整流,整流后由电容滤波,再由7805芯片稳压,输出稳定的+5V电压。
2.1.1 7805概述电子产品中,常见的三端稳压集成电路有正电压输出的78**系列和负电压输出的79**系列。
顾名思义,三端IC是指这种稳压用的集成电路,只有三条引脚输出,分别是输入端、接地端和输出端。
它的样子象是普通的三极管,TO- 220 的标准封装,也有9013样子的TO-92封装。
用78/79系列三端稳压IC来组成稳压电源所需的外围元件极少,电路内部还有过流、过热及调整管的保护电路,使用起来可靠、方便,而且价格便宜。
该系列集成稳压IC型号中的78或79后面的数字代表该三端集成稳压电路的输出电压,如7806表示输出电压为正6V,7909表示输出电压为负9V。
78**系列的稳压集成块的极限输入电压是36V,最低输入电压为输出电压的3-4V以上。
2.2复位电路图3 按钮复位电路按钮复位电路(如图3)是上电复位加手动复位,使用比较方便,在程序跑飞时,可以手动复位,这样就不用重启单片机电源,就可以实现复位,一般按键时间为10ms。
2.3紧急情况电路图4 紧急情况控制电路当出现紧急情况时,按下开关S2,使INT0口处于低电平,然后直接传递给给单片机的P3.2口,INT0是P3.2口的第二功能端口,是单片机的外部中断,触发外部中断有两种情况:(1)下降沿触发(2)低电平触发这里的紧急情况电路所用的触发方式是低电平触发方式,当INT0口处于低电平时,触发单片机的外部中断,使之执行中断程序,所有的红灯亮,时间显示为0,达到紧急情况所需要求。