单片机控制交通灯.doc
单片机控制交通灯,摘要 近年来随着科技的飞速发展,单片机的应用正在不断地走向深入,同时带动传统控制检测日新月异更新。 十字路口车辆穿梭,行人熙攘,车行车道,人行人道,有条不紊。那么靠什么来实现这井然秩序呢?靠的是交通信号灯的自动指挥系统。交通信号灯控制方式很多。本系统采用msc-51系列单片机intel8031和可编程并行i/o接口芯片...
内容介绍
此文档由会员 csfujixie 发布摘要
近年来随着科技的飞速发展,单片机的应用正在不断地走向深入,同时带动传统控制检测日新月异更新。
十字路口车辆穿梭,行人熙攘,车行车道,人行人道,有条不紊。那么靠什么来实现这井然秩序呢?靠的是交通信号灯的自动指挥系统。交通信号灯控制方式很多。本系统采用MSC-51系列单片机Intel8031和可编程并行I/O接口芯片8255A为中心器件来设计交通灯控制器,实现了能根据实际车流量通过8031芯片的P1口设置红、绿灯燃亮时间的功能;为了系统稳定可靠采用了MAX629“看门狗”芯片,避免了系统因为死机而停止工作的情况发生;显示时间直接通过8255的PA、PB口输出;交通灯信号通过PC口输出;交通灯的点亮采用VT双向晶闸管来控制,直接采用220V交流电源驱动,系统实用性强、操作简单、扩展性强。
在实时检测和自动控制的单片机应用系统中,单片机往往是作为一个核心部件来使用,仅单片机方面知识是不够的,还应根据具体硬件结构,以及针对具体应用对象特点的软件结合,加以完善。
关键词:单片机 ; 交通灯; 控制器; 设计; 实现
ABSTRACT
In recent years along with science and technology develop fast, the application of single flat machine is moving towards thorough continuously, at the same time drive traditional control detection day the benefit of new moon update. In the only flat machine application system of the automatic control and detection of real time, only flat machine is often to use as a key parts, only single flat machine aspect knowledge is insufficient , return should basis specificly hardware structure, as well as aim at the software that applies object characteristic specificly combination, perfect.
Crossroads vehicle wear comb, pedestrian Xi Rang, turn to be all right lane, person pedestrian says , methodically. Do you lean what to realize this orderly order? What lean is that the automatic command system of traffic signal lamp. Traffic signal lamp control way is many . This system adopts MSC-51 series only flat machine Intel8031 with but programming parallel interface chip 8255 A of I/O is central device the design controler of traffic lights, haverealized can measure according to actual wagon flow the P1 installation bonus and green light that passes through 8031 chips burn to light the function of time; For system stabilize reliable have adopted MAX629 the chip " dog looks after the house ", have avoided that system stops working condition because of halting to occur; Show that time is directly exported through PB and PA of 8255; The signal of traffic lights is exported through usually PC mouth; The point of traffic lights light to adopt VT two-way Jing floodgate pipe come to control, directly drive with the alternating current source of 220 V, practicality is strong, operating is simple.
Keywords: Only flat machine Traffic lights Controler Design Realize
目录
摘要.................................................................................I
Abstract........................................................................... II
1 引言 ...........................................................................1
2 单片机概述.........................................................................1
3.1 MSC-51芯片简介.................................................................1
3.2 5芯片简介....................................................................4.
3.3 74LS373简介 ..................................................................5
4 系统硬件设计......................................................................5
4.1交通管理的方案论证 .........................................................5
4.2系统硬件设计................................................................. 6
4.2.1 系统总框图............................................................... 6
4.2.2 交通灯硬件线路图...........................................................7
4.23系统的工作原理...............................................................7
5.控制器的软件设计..................................................................7
5.1每秒钟的设定............................................................. ...7
5.2计数器硬件延时............................................................ ...7
5.2.1 计数器初值计算................................................ .. .... .....7
5.2.2 计算公式................................................... ..............7
5.2.3 1秒的方法.............................................. .................8
5.2.4相应程序代码......................................................... ... ...8
5.3 软件延时.....................................................................8
5.4 时间及信号灯的显示.......................................................... 9
5.4.1 8051并行口的扩展....................................................... . .9
5.4.2显示原理:...................................................................9
5.4.3 8255PA口输出信号接信号灯:............................................... .9
5.4.4 8255输出信号与数码管的连接:................................................ 10
5.4.5 8255与8051的连接:..........................................................10
5.5 程序设计................................................................... 10
5.5.2 程序源代码............................................................. ...11
6 结论.................................................................... . ... . ...18
参考文献..................................................................... ... ...17
附录............................................................................ ...18.