1、 单片机技术课程设计说明书单片机技术课程设计说明书 交通灯的设计 院 、 部: 电气与信息工程学院 学生姓名: 单片机技术课程设计任务书 一、设计题目:交通灯 二、适用班级:电子 1201 三、指导教师: 四、设计目的与任务: 学生通过理论设计和实物制作解决相应的实际问题,巩固和运用在单片机 技术中所学的理论知识和实验技能,掌握单片机应用系统的一般设计方法,提 高设计能力和实践动手能力,为以后从事电子电路设计、研发电子产品打下良好 的基础。 五、设计内容与要求 设计一个具有特定功能的十字路口交通灯。 该交通灯上电或按键复位后能自 动显示系统提示符“P.”, 进入准备工作状态。按开始键则开始工作
2、,按结束键则 返回“P.”状态。要求甲车道和乙车道两条交叉道路上的车辆交替运行,甲车道为 主车道,每次通车时间为 60 秒,乙车道为次车道,每次通车时间为 30 秒,要求 黄灯亮 3 秒,并且 1 秒闪烁一次。有应急车辆出现时,红灯全亮,应急车辆通车 时间 10 秒,同时禁止其他车辆通过。 I 摘 要 近年来随着科技的飞速发展,单片机的应用正在不断深入,同时带动传统控 制检测技术日益更新。十字路口行人,车辆众多,要靠什么来实现这井然的秩序 呢?靠的就是交通信号灯的自动指挥系统。交通信号灯控制方式很多。 本设计由单片机系统、LED 驱动电路及交通灯演示电路等组成。系统主要 用 AT89C51 的
3、 P1、P2、P3 口来实现对 LED 灯的控制,为了防止意外发生的应 急车强行通过的车辆, 还专门设置了应急控制键,可根据实际情况手动控制。 关键词:AT89C51 单片机;交通灯;应急通道 II ABSTRACT In recent years, with the rapid development of science and technology, SCM applications are deepening, drive traditional control test technology is increasingly update at the same time. Numer
4、ous crossing pedestrians and vehicles, want to rely on what to do this in order? Rely on is the automatic command system of traffic lights. A lot of traffic signal lamp control way. This design by the single-chip microcomputer system, LED drive circuit and traffic lights show circuit, etc. System ma
5、inly use P1, P2, P3 mouth to realize the control of the LED lamp, in order to prevent the accident emergency car force through vehicle, also specially set up emergency control key, can be manually controlled according to the actual situation. Key words AT89C51; Traffic lights; Emergency channel I 目目
6、 录录 1 设计方案. 1 1.1 原始方案 1 1.2 最终方案 1 2 交通灯控制系统硬件的设计. 2 2.1 交通灯变换规律 . 2 2.2 原理说明 . 2 2.3 功能模块的设计 . 3 2.3.1 晶振电路 3 2.3.2 复位电路 3 2.3.3 数码管显示电路 4 2.3.4 按键电路 5 2.3.5 指示灯电路 6 3 交通灯软件系统的设计. 7 3.1 单片机资源的使用情况 . 7 3.2 程序流程图 8 5 Proteus 仿真 10 5.1 仿真结果 10 5.2 误差分析 11 6 实物调试 12 6.1 实物调试说明 12 6.2 调试结果 12 结束语. 14 参考文献. 15 附 录. 18 附 录 A:程序 18 附 录 B:电路原理图 22 附 录 C:PCB 图 23 附 录 D:元器件清单 24 附 录 E:实物图 25 1 1 设计方案设计方案 1.1 原始方案 根据设计的要求我要设计一个东西南北四个方向共十二个灯的交通灯控制 器,每个方向三个灯,红、黄、绿各一个。其中东西两个方向灯的显示情况是一 样