Development of Single Chip Microcomputer for Traffic Light Control Circuit Board

Development of Single Chip Microcomputer for Traffic Light Control Circuit Board1. 控制要求 十字路口交通灯的运行如下图所示。当起动开关接通时,信号灯系统开始工作,且先南北红灯亮,东西绿灯亮。当起动开关断开时,所有的信号灯全部熄灭。工作时绿灯亮 25s ,并闪烁 3 次(即 3s ),黄灯亮 2s ,红

  • Model: Development of Single Chip Microcomputer for Traffic Light Control Circuit Board

Development of Single Chip Microcomputer for Traffic Light Control Circuit Board

深圳单片机开发

1. 控制要求
        十字路口交通灯的运行如下图所示。当起动开关接通时,信号灯系统开始工作,且先南北红灯亮,东西绿灯亮。当起动开关断开时,所有的信号灯全部熄灭。工作时绿灯亮 25s ,并闪烁 3 次(即 3s ),黄灯亮 2s ,红灯亮 30s 。
各方向三色灯的工作时序图如下图所示。

深圳单片机开发

图 交通灯控制时序图

2 .分析 plc 的输入和输出信号
        根据控制要求, PLC 的 I/O 地址分配如下表所示, PLC 的 I/O 接线图如下图所示。
表 交通灯 I/O 分配


输入输出




控制开关东西绿灯东西黄灯东西红灯南北红灯南北绿灯南北黄灯
X0Y1Y2Y3Y4Y5Y6

深圳单片机开发

图 交通灯的 I/O 接线图

3 .由时序图分析各输出信号之间的时间关系

        交通灯一个循环共需要 60s ,它分为 6 个时间段,这 6 个时间区段对应着 6 个分界点: t1 、 t2 、 t3 、 t4 、 t5 、 t6 。在这 6 个分界点处信号灯的状态将发生变化,在程序设计中这 6 个时间段必须使用 6 个定时器来控制。
        为了明确各定时器的作用,以便于理解各个灯的状态转换的准确时间,列出了各定时器的功能,如下表所示。
表 各定时器的功能:
定时器         定时时间        功能
T0                25s                东西绿灯定时 25s ,同时起动东西绿灯开始闪烁
T1                28s                东西绿灯闪烁定时 3s ,同时起动东西黄灯亮
T2                30s                南北红灯定时 30s ,同时起动南北绿灯和东西红灯亮
T3                55s                南北绿灯定时 25s ,同时起动南北绿灯开始闪烁
T4                58s                南北绿灯闪烁定时 3s ,同时起动南北黄灯亮

T5                60s                东西红灯定时 30s ,同时起动东西绿灯和南北红灯亮

4 .梯形图程序设计
根据红绿灯的控制要求,设计的梯形图如下图所示。

深圳单片机开发

The program is divided into three parts. The first part is a square wave circuit used to generate a green light flashing signal; the second part is a timing circuit, which requires 6 timers to time the state changes of the north-south and east-west direction lights; third; Part of it is an indicating circuit, which is used to control the changes of the two direction signal lights.