交通灯控制系统
EDA实验报告
2014
2014
姓名:
学号:
课题名称
用状态机设计的交通信号控制系统。
实验目的
利用所学习的EDA相关知识,完成对交通灯控制系统的设计并实现,提高对所学知识的理解和利用熟练程度。
设计任务
设计一个十字路口交通控制系统,要求如下:
东西(用A表示)、南北(用B表示)方向均有绿灯、黄灯、红灯指示,持续时间分别是40秒、五秒和45秒,交通灯运行的切换示意图与时间关系如下。
交通控制系统运行切换示意图
更方向灯光时间关系
系统设有时钟,以倒计时的方式显示每一路允许通行的时间。
当东西或南北两路中任意一路出现特殊状况时,系统可由交警手动控制立即进入特殊运行状态,即红灯全亮,始终停止计时,东西、南北两路所有车辆禁止通行;当特殊状况结束后,系统恢复工作,继续正常运行。
实验过程
VHDL设计流程
交通控制系统顶层原理图如下,它主要由50MHz分频器(devide50M)、控制器(control)、45秒倒计时计数器(m45)、7字段译码器(SEG7)组成。
控制器的设计
控制器的逻辑符号如图所示。其中CLK为时钟输入信号;HOLD为紧急制动信号;ARED、AGREEN、AYELLOW分别为东西方向的红灯、绿灯、黄灯指示的输出信号;BRED、BGREEN、BYELLOW分别为南北方向的红灯、绿灯、黄灯指示的输出信号。
控制器的VHDL描述文件control.vhd如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity control is
port(clk,hold:in std_logic;
ared,agreen,ayellow,bred,bgreen,byellow:out std_logic);
end control;
architecture behavior of control is
type state_type is (s0,s1,s2,s3,s4);
signal current_state,next_state:state_type;
signal counter : std_logic_vector(6 downto 0);
begin
synch:process
begin
wait until clkevent and clk=1;
if hold=0 then --当紧急制动信号有效时,计数器停止计数
counter=counter;
else
if counter89 then
counter=counter+1;
else
counter=(others=0);
end if;
end if;
end process;
process --待机状态
begin
wait until clkevent and clk=1;
current_state= next_state;
end process;
state_trans:process(current_state)
begin
case current_state is
when s0=
if hold=0 then
next_state=s4;
else
if counter39 then
next_state=s0;
else
next_state=s1;
end if;
end if;
when s1=
if hold=0 then
next_state=s4;
else
if counter44 then
next_state=s1;
else
next_state=s2;
end if;
end if;
when s2=
if hold=0 then
next_state=s4;
else
if counter84 then
next_state=s2;
else
next_state=s3;
end if;
end if;
when s3
=
if hold=0 then
next_state=s4;
else
if counter89 then
next_state=s3;
else
next_state=s0;
end if;
end if;
when
您可能关注的文档
最近下载
- 重症肺结核诊断和治疗专家共识.pptx VIP
- 某某市税务局“岗位大练兵 业务大比武”活动实施方案范本.doc VIP
- T∕CSAE 91-2018 汽车生命周期温室气体及大气污染物排放评价方法.pdf
- 个人独资企业章程.pdf VIP
- 2026年中小学寒假安全教育主题班会课件PPT.pptx VIP
- 5 《火灾自动报警系统施工及验收规范》(GB50166--92)附表.pdf VIP
- 光伏电站并网启动调试方案.pdf VIP
- pNC系统载体使用说明.PDF
- 小学篮球兴趣小组教学计划范文(32篇).docx VIP
- 山东省临沂市罗庄区2024-2025学年七年级上学期期末考试地理试题.pdf VIP
原创力文档

文档评论(0)