设计一个十字路口的交通灯控制系统_第1页
设计一个十字路口的交通灯控制系统_第2页
设计一个十字路口的交通灯控制系统_第3页
设计一个十字路口的交通灯控制系统_第4页
设计一个十字路口的交通灯控制系统_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

设计一个十字路口的交通灯控制系统,用实验平台上的LED发光二极管显示车辆通过的方向(东西和南北各一组),用数码管显示该方向的剩余时间。要求:工作顺序为东西方向红灯亮45秒,前40秒南北方向绿灯亮,后5秒黄灯亮。然后南北方向红灯亮45秒,前40秒东西方向绿灯亮,后5秒黄灯亮。依次重复。有紧急事件时允许将某方向一直开绿灯或者开红灯,另外允许特定情况两方向均为红灯,车辆禁行,比如十字路口恶性交通事故时,东西,南北两个方向均有两位数码管适时显示该方向亮灯时间。问题补充: 我是要做课程设计,只要有程序就行最佳答案 -交通灯控制器设计?-led显示规律:东西方向绿灯,而南北方向红灯-东西方向绿灯灭,黄灯亮,南北方向仍然红灯-/南北方向绿灯,而东西方向红灯。/library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity jiaotongLED is generic(-定义灯亮的时间 east_green_cnt:integer:=40;-东西方向主干道绿灯 east_yellow_cnt:integer:=5;-东西方向主干道黄灯 south_green_cnt:integer:=40;-南北方向支干道绿灯 south_yellow_cnt:integer:=5;-南北方向支干道黄灯 exi_cnt:integer:=120);-紧急车辆通行时间 port(clk:in std_logic; rst:in std_logic;-复位信号 exi_sign:in std_logic;-紧急车辆信号 east_green_led:out std_logic; east_yellow_led:out std_logic; east_red_led:out std_logic; south_green_led:out std_logic; south_yellow_led:out std_logic; south_red_led:out std_logic);end jiaotongLED;-architecture ex of jiaotongLED istype states is(s0,s1,s2,s3,s4);signal state1:states:=s0;signal state:states:=s0;signal cnt:integer range 0 to 150;signal save_cnt:integer;signal enable_cnt:std_logic:=0;begin-u1:process(rst,clk)-信号灯的时间状态的转换begin if rst=1 then-判断是否按下复位 state=s0; cnt=1; elsif clkevent and clk=1 then if enable_cnt=1 then cnt=cnt+1; else cnt if exi_sign=1 then-判断是否紧急车辆 save_cnt=cnt; state1=s0; state=s4; elsif(cnt=east_green_cnt)then state=s1; else state if exi_sign=1 then save_cnt=cnt; state1=s1; state=s4; elsif(cnt=east_yellow_cnt)then state=s2; else state if exi_sign=1 then save_cnt=cnt; state1=s2; state=s4; elsif(cnt=south_green_cnt)then state=s3; else state if exi_sign=1 then save_cnt=cnt; state1=s3; state=s4; elsif(cnt=south_yellow_cnt)then state=s0; else state if(cnt=exi_cnt)then cnt=save_cnt; state east_green_led=1; east_yellow_led=0; east_red_led=0; south_green_led=0; south_yellow_led=0; south_red_led=1; enable_cnt=1; if(cnt=east_green_cnt)then enable_cnt east_green_led=0; east_yellow_led=1; east_red_led=0; south_green_led=0; south_yellow_led=0; south_red_led=1; enable_cnt=1; if(cnt=east_yellow_cnt)then enable_cnt east_green_led=0; east_yellow_led=0; east_red_led=1; south_green_led=1; south_yellow_led=0; south_red_led=0; enable_cnt=1; if(cnt=south_green_cnt)then enable_cnt east_green_led=0; east_yellow_led=0; east_red_led=1; south_green_led=0; south_yellow_led=1; south_red_led=0; enable_cnt=1; if(cnt=south_yellow_cnt)then enable_cnt east_green_led=0; east_yellow_led=0; east_red_led=1; south_green_led=0; south_yellow_led=0; south_red_led=

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论