最新交通灯控制系统EDA实验报告.docx

上传人:w**** 文档编号:1982134 上传时间:2023-05-02 格式:DOCX 页数:13 大小:10.45KB
下载 相关 举报
最新交通灯控制系统EDA实验报告.docx_第1页
第1页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第2页
第2页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第3页
第3页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第4页
第4页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第5页
第5页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第6页
第6页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第7页
第7页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第8页
第8页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第9页
第9页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第10页
第10页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第11页
第11页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第12页
第12页 / 共13页
最新交通灯控制系统EDA实验报告.docx_第13页
第13页 / 共13页
亲,该文档总共13页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

最新交通灯控制系统EDA实验报告.docx

《最新交通灯控制系统EDA实验报告.docx》由会员分享,可在线阅读,更多相关《最新交通灯控制系统EDA实验报告.docx(13页珍藏版)》请在冰点文库上搜索。

最新交通灯控制系统EDA实验报告.docx

?

交通灯控制系统EDA实验报告

  姓名:

学号:

一、课题名称用状态机设计的交通信号控制系统。

  二、实验目的利用所学习的EDA相关知识,完成对交通灯控制系统的设计并实现,提高对所学知识的理解和利用熟练程度。

  三、设计任务设计一个十字路口交通控制系统,要求如下:

  a.东西〔用A表示〕、南北〔用B表示〕方向均有绿灯、黄灯、红灯指示,持续时间分别是40秒、五秒和45秒,交通灯运行的切换示意图与时间关系如下。

  交通控制系统运行切换示意图更方向灯光时间关系

  b.系统设有时钟,以倒计时的方式显示每一路允许通行的时间。

  c.当东西或南北两路中任意一路出现特殊状况时,系统可由交警手动控制立即进入特殊运行状态,即红灯全亮,始终停止计时,东西、南北两路所有车辆禁止通行;当特殊状况结束后,系统恢复工作,继续正常运行。

  四、实验过程

  a.VHDL设计流程

  b.交通控制系统顶层原理图如下,它主要由50MHz分频器〔devide50M〕、控制器〔control〕、45秒倒计时计数器〔m45〕、7字段译码器〔SEG7〕组成。

  1)控制器的设计控制器的逻辑符号如以下图。

其中CLK为时钟输入信号;HOLD为紧急制动信号;

  ARED、AGREEN、AYELLOW分别为东西方向的红灯、绿灯、黄灯指示的输出信号;

  BRED、BGREEN、BYELLOW分别为南北方向的红灯、绿灯、黄灯指示的输出信号。

控制器的VHDL描述文件

  control.vhd如下:

  libraryieee;

  use

  ieee.std_logic_

  1164.all;

  use

  ieee.std_logic_

  unsigned.all;

  entitycontrolisport(clk,

  hold:

instd_logic;

  ared,agreen,ayellow,bred,bgreen,

  byellow:

outstd_logic);

  endcontrol;

  architecturebehaviorofcontrolistypestate_typeis(s0,s1,s2,s3,s4);

  signalcurrent_state,next_

  state:

state_type;

  signalcounter:

std_logic_vector(6downto0);

  begin

  synch:

processbeginwaituntilclk'eventandclk='1';

  ifhold='0'then--当紧急制动信号有效时,计数器停止计数counter<=counter;

  elseifcounter<89thencounter<=counter+1;

  elsecounter<=(others=>'0');

  endif;

  endif;

  endprocess;

  process--待机状态beginwaituntilclk'eventandclk='1';

  current_state<=next_state;

  endprocess;

  state_

  trans:

process(current_state)begincasecurrent_stateiswhens0=>

  ifhold='0'thennext_state<=s4;

  elseifcounter<39thennext_state<=s0;

  elsenext_state<=s1;

  endif;

  endif;

  whens1=>

  ifhold='0'thennext_state<=s4;

  elseifcounter<44thennext_state<=s1;

  elsenext_state<=s2;

  endif;

  endif;

  whens2=>

  ifhold='0'thennext_state<=s4;elseifcounter<84thennext_state<=s2;

  elsenext_state<=s3;

  endif;

  endif;

  whens3=>

  ifhold='0'thennext_state<=s4;

  elseifcounter<89thennext_state<=s3;

  elsenext_state<=s0;

  endif;

  endif;

  whens4=>

  ifhold='0'thennext_state<=s4;

  elseifcounter<39thennext_state<=s0;

  elsifcounter<44thennext_state<=s1;

  elsifcounter<84thennext_state<=s2;elsifcounter<89thennext_state<=s3;

  endif;

  endif;

  endcase;

  endprocess;

  output:

process(current_state)--每种状态下两个路口红绿灯的状态描述begincasecurrent_stateiswhens0=>

  ared<='0';

  agreen<='1';

  ayellow<='0';

  bred<='1';

  bgreen<='0';

  byellow<='0';

  whens1=>

  ared<='0';

  agreen<='0';

  ayellow<='1';

  bred<='1';

  bgreen<='0';

  byellow<='0';

  whens2=>

  ared<='1';

  agreen<='0';

  ayellow<='0';

  bred<='0';

  bgreen<='1';

  byellow<='0';

  whens3=>ared<='1';

  agreen<='0';

  ayellow<='0';

  bred<='0';

  bgreen<='0';

  byellow<='1';

  whens4=>

  ared<='1';

  agreen<='0';

  ayellow<='0';

  bred<='1';

  bgreen<='0';

  byellow<='0';

  endcase;

  endprocess;

  endbehavior;

  2)倒计时计数器M45的设计倒计时计数器M45的逻辑符号如图。

  其中

  CLK、EN、CR分别是时钟、计数使能和清零端,QL[

  3..0]、QH[

  3..0]、OC分别是BCD码的个位、十位和进位输出。

  VHDL描述文件m45.vhd如下:

  libraryieee;

  use

  ieee.std_logic_

  1164.all;

  use

  ieee.std_logic_

  unsigned.all;

  entitym45isport(CLK:

instd_logic;

  EN:

instd_logic;

  CR:

instd_logic;

  QL,QH:

outstd_logic_vector(3downto0);OC:

outstd_logic);

  endm45;

  architecturebehaveofm45issignalcouL,

  couH:

std_logic_vector(3downto0);

  beginprocess(CR,CLK,EN)beginifCR='0'then--异步清零couL<=“0000“;

  couH<=“0000“;

  elsifclk'eventandclk='1'thenifEN='1'thenif(couL=0andcouH=0)then--减法计到00后,重新置数44couL<=“0100“;

  couH<=“0100“;

  elsifcouL=0then--否那么个位计到0时置为9,十位减1couL<=“1001“;

  couH<=couH-1;

  elsecouL<=couL-1;

  --否那么个位减1endif;endif;

  endif;

  endprocess;

  process(couL,couH)beginif(couL=0andcouH=0)thenOC<='1';

  --减到00时有借位输出elseOC<='0';

  endif;

  endprocess;

  QL<=couL;

  QH<=couH;

  endbehave;

  3)7字段译码器电路的设计7字段译码器的功能是将8421BCD码译成7个信号,用以启动7段数码管显示相应的十进制数码,逻辑符号如图。

dat[

  3..0]是8421BCD码的输入,

  a、b、c、d、e、f、g是驱动数码管显示的7个输出信号〔低电平有效〕。

  VHDL描述文件seg7.vhd如下:

  libraryieee;

  use

  ieee.std_logic_

  1164.all;

  entityseg7isport(dat:

instd_logic_vector(3downto0);

  a,b,c,d,e,f,g:

outstd_logic);

  endseg7;

  architecturearcofseg7issignaltmp:

std_logic_vector(6downto0);

  beginprocess(dat)begincasedatiswhen“0000“=>tmp<=“0000001“;

  --输入0000时,显示0when“0001“=>tmp<=“1001111“;

  --输入00001时,显示1when“0010“=>tmp<=“0010010“;

  when“0011“=>tmp<=“0000110“;

  when“0100“=>tmp<=“1001100“;

  when“0101“=>tmp<=“0100100“;

  when“0110“=>tmp<=“0100000“;

  when“0111“=>tmp<=“0001111“;

  when“1000“=>tmp<=“0000000“;

  when“1001“=>tmp<=“0000100“;

  --显示9when“1010“=>tmp<=“0001000“;

  --显示Awhen“1011“=>tmp<=“1100000“;

  when“1100“=>tmp<=“0110001“;

  when“1101“=>tmp<=“1000010“;

  when“1110“=>tmp<=“0110000“;

  when“1111“=>tmp<=“0111000“;

  endcase;

  endprocess;

  a<=tmp

  (6);

  b<=tmp

  (5);

  c<=tmp

  (4);

  d<=tmp

  (3);

  e<=tmp

  

(2);

  f<=tmp

  

(1);

  g<=tmp

  (0);

  endarc;

  4)50MHz分频器的设计逻辑符号如图,目的是将输入信号转化为1HZ输出。

clk为信号输入端,clk_out为信号输出端。

  VHDL描述文件devide50M.vhd如下:

libraryieee;

  use

  ieee.std_logic_

  1164.all;

  use

  ieee.std_logic_

  unsigned.all;

  entitydevide50Misport(clk:

instd_logic;

  clk_out:

outstd_logic);

  enddevide50m;

  architecturearc_devide50Mofdevide50Missignal

  count:

std_logic_vector(25downto0);

  beginprocessbeginwaituntilclk'eventandclk='1';

  if(count<50000000)thencount<=count+1;

  clk_out<='0';

  elsecount<=(others=>'0');

  clk_out<='1';

  endif;

  endprocess;

  endarchitecturearc_devide50M;

  c.管脚设计因为使用的是CycloneIII_EP3C16F484C6型号的电路板,因此管脚连接如下:

  CycloneIII_EP3C16F484C6型号的电路板管脚连接图

  五、实验结果波形仿真结果

  六、实验心得通过这次设计,进一步加深了对VHDL语言的了解,让我对它有了更加浓厚的兴趣。

在文件编写的过程中,我遇到了不少问题,包括最开始的无从下手到各元件之间的连接,引脚的设定,但最终还是克服了这些困难。

建议以后的课程中将上机操作与课程理论教学相结合,这样也许就能够更好的帮助我们学习EDA。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2