《项目7 交通灯设计1》.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
项目七 交通灯设计 班级:09电信 姓名:曾珍 学号:33 实训目标 利用VHDL语言来完成对交通灯的控制设计。 强化时序电路设计能力,和控制逻辑的处理。 在EDA-V+系统上实现交通灯控制系统。 实训步骤 输入交通信号灯的VHDL代码。 设计要求如下: 当主干道绿灯亮了4分钟后,仪器监测到支路有车辆等待,交通灯立刻转换。然后仪器一直监测到有车辆通过,到了50秒时,交通灯强制转换,支路车辆必须等待,直到主干道绿灯又亮了4分钟,交通灯才开始转换,支路车辆允许通过。如果主干道绿灯亮了4分钟后支路仍无车辆等待,交通灯不转换。 实训数据 写出程序代码。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity TrafficLight is port (start:in std_logic; clk: in std_logic; car_d:in std_logic; green_m,yellow_m,red_m:out std_logic; green_d,yellow_d,red_d:out std_logic ); end TrafficLight; architecture beh of TrafficLight is signal counter_green_m:integer; signal counter_flash1:integer; signal counter_flash2:integer; signal counter_judge1:integer; signal counter_judge2:integer; signal f1_green_m,f2_green_m:std_logic; signal f_green_d:std_logic; signal greentored_m: std_logic; signal redtogreen_m: std_logic; signal judge:std_logic; begin process(clk) begin if clkevent and clk=1 then if start=0 then f1_green_m=1; f2_green_m=1; green_m=1; yellow_m=0; red_m=0; green_d=0; yellow_d=0; red_d=1; judge=0; counter_green_m=0; counter_flash1=0; counter_flash2=0; greentored_m=0; redtogreen_m=0; else if f1_green_m=1 then counter_green_m=counter_green_m+1; if counter_green_m=24 then if car_d=1 then greentored_m=1; f1_green_m=0; elsif counter_green_m=36 then greentored_m=1; f1_green_m=0; else greentored_m=0; f1_green_m=1; end if; end if; end if; if greentored_m=1 then counter_flash1=counter_flash1+1 if counter_flash1=3 then f2_green_m=not f2_green_m; green_m=f2_green_m; elsif counter_flash1=6 then yellow_m=1; else yellow_m=0; red_m=1; greentored_m=0; green_d=1; f_green_d=1; red_d=0; counter_flash1=0; judge=1; counter_judge1=0; counter_judge2=0; end if; end if; if judge=1 then counter_judge1=counter_judge1+1; if

文档评论(0)

shashan + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档