1843.EDA综合设计性实验报告——交通灯控制器.doc

上传人:土8路 文档编号:10407150 上传时间:2021-05-15 格式:DOC 页数:14 大小:806.50KB
返回 下载 相关 举报
1843.EDA综合设计性实验报告——交通灯控制器.doc_第1页
第1页 / 共14页
1843.EDA综合设计性实验报告——交通灯控制器.doc_第2页
第2页 / 共14页
1843.EDA综合设计性实验报告——交通灯控制器.doc_第3页
第3页 / 共14页
1843.EDA综合设计性实验报告——交通灯控制器.doc_第4页
第4页 / 共14页
1843.EDA综合设计性实验报告——交通灯控制器.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《1843.EDA综合设计性实验报告——交通灯控制器.doc》由会员分享,可在线阅读,更多相关《1843.EDA综合设计性实验报告——交通灯控制器.doc(14页珍藏版)》请在三一文库上搜索。

1、EDA综合设计性实验报告 交通灯设计 姓 名: 班 级: 电信 学 号: 指导老师: 日期: 2007.12 大学工程学院目 录1 实验目的22 实验要求33 程序编写54 程序调试及分析105 讨论及进一步研究建议126 综合设计性实验心得13参考文献141实验目的1、掌握较复杂逻辑的设计、调试。2、掌握数字电路模块层次设计。3、掌握功能分割的方法。4、熟悉交通灯的工作原理。2.实验要求1、正常控制正常控制时交通信号灯的时序如图4.1所示。为了使学生对控制要求有一个清晰的思路,同时也为了描述的方便,先分析一个方向上交通灯的变化情况。当启动开关接通时,信号灯开始工作。先东西方向绿灯亮(此时南北

2、方向红灯亮。但右转弯绿灯亮),允许通行30S,左右转向均红灯亮。30S后,东西方向绿灯灭而黄灯亮2S,同时右转弯的黄灯也亮2S,然后东西方向红灯亮,同时右转弯的绿灯亮(右转弯的红灯黄灯同时灭)。即此时东西方向仅允许右转弯。55S后,东西方向左转弯黄灯亮2S,接着也允许左转弯(左转弯红灯、黄灯灭,同时绿灯亮)。16S后,左右转弯的绿灯同时闪三下(指示信号灯将变化)后灭。左右转弯黄灯2S后灭而红灯亮,东西方向黄灯也亮2S,然后整体便进入下一个循环。东西向人行道仅有红灯和绿灯,人行道红灯变化情况和东西向中间红灯类似。仅先于中间灯2S,人行道绿灯和中间绿灯变化也类似,区别仅在点亮的最后3S闪烁而已。综

3、合上面的分析可以看出,交通道揭示的总体思路是,先允许直向通行,后允许友转弯,然后允许左右转弯,如此反复循环。南北方向的交通灯变化与东西方向次序完全一样,只不过时间上滞后55S而已。即当东西方向允许左右转向。当起动开关断开时。所有信号灯熄灭。2、急车通行控制急车强通方向由急车强通开关控制。无急车时信号灯按正常时序控制。有急车来时,将急车强通开关闭合,不管原来信号灯的状态如何,一律强制让急车来方向的绿灯亮,直至急车通过为止。急车过后,将急车强通开关断开,信号灯的状态立即转为急车方向上的绿灯闪3次,随后按正常时序控制。急车通行信号只能响应一路方向的急车,若两个方向先后来急车,则响应先来的一方,随后再

4、响应另一方。3、分析得状态表:“1”表示亮,”0”表示灭,“( 1)”表示闪烁;0、0、0红、黄、绿;人行道0、0红、绿状态时间(S)方向中间灯人行道右转灯左转灯S00-27东西00101100100南北10010001100S127-30东西0010(1)100100南北10010001100S230-32东西01010110100南北10010001110S332-48东西10010001100南北10010001001S448-51东西10010001100南北1001000(1)00(1)S551-53东西10010001100南北10010010010S653-55东西1001000

5、1100南北11010100100S755-82东西10010001100南北00101100100S882-85东西10010001100南北0010(1)100100S985-87东西10010001110南北01010110100S1087-103东西10010001001南北10010001100S11103-106东西1001000(1)00(1)南北10010001100S12106-108东西10010010010南北10010001100S13108-110东西11010100100南北10010001100S14111-114东西00(1)10100100南北10010100

6、100S15116-119东西10010100100南北00(1)101001003.程序编写1、 打开ryg.vhd文件,并将之设为当前项目。2、 ryg.vhd的源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ryg isport( rst : in std_logic; - reset 1enable clk2 : in std_logic; - 2Hz clock rush_w : in std_logic; - the emergency car signal of

7、 the west and the east - 0 enable rush_s : in std_logic; - the emergency car signal of the south and tne north -0 enable - vector is middle(8-6) right(5-3) left(2-0) ( red yellow green ) west_east : buffer std_logic_vector(8 downto 0); -the west and east lights-which flash in the same way man_w : bu

8、ffer std_logic_vector(1 downto 0); -the west&east sideway lights south_north: buffer std_logic_vector(8 downto 0); -the south and north lights -which flash in the same way man_s : buffer std_logic_vector(1 downto 0) -the south&nouth sideway lights );end entity ryg;architecture do of ryg isTYPE count

9、_state is (s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13);signal state : count_state:=s0;signal is_normal : std_logic:=1; - normal-1signal count :integer range 0 to 120; - time countsignal clk : std_logic; - (siganl) 1Hz clock beginis_normal = rush_w and rush_s;process(clk2) -divide 2Hz to 1Hzbegini

10、f clk2event and clk2=1 thenclk=not clk;end if;end process;process(clk) -the time counter and the state changerbeginif rst=1 then count=0; elsif clkevent and clk=1 then if is_normal=1 then count =0 and count=28 then state28 and count=30 then state30 and count=32 then state32 and count=48 then state48

11、 and count=51 then state51 and count=53 then state53 and count=55 then state55 and count=83 then state83 and count=85 then state85 and count=87 then state87 and count=103 then state103 and count=106 then state106 and count=108 then state108 and count=110 then state=s13; else state=s0;count -middle r

12、ight left (red yellow green) west_east = 001100100; - 001 100 100 south_north = 100001100; - 100 001 100 man_w = 01; man_s west_east = 001100100; - 001 100 100 south_north = 100001100; - 100 001 100 man_w(0) = not man_w(0); man_s west_east = 010110100; - 010 110 100 south_north = 100001110; - 100 00

13、1 110 man_w = 10; man_s west_east = 100001100; - 100 001 100 south_north = 100001001; - 100 001 001 man_w = 10; -keep the same man_s west_east = 100001100; - 100 001 100 south_north(0) = not south_north(0); south_north(3) = not south_north(3); man_w = 10; -keep the same man_s west_east = 100001100;

14、- 100 001 100 south_north = 100010010; - 100 010 010 man_w = 10; man_s west_east = 100001100; - 100 001 100 south_north = 110100100; - 110 100 100 man_w = 10; man_s west_east = 100001100; - 100 001 100 south_north = 001100100; - 001 100 100 man_w = 10; man_s west_east = 100001100; - 100 001 100 sout

15、h_north = 001100100; - 001 100 100 man_w = 10; man_s(0) west_east = 100001110; - 100 001 110 south_north = 010110100; - 010 110 100 man_w = 10; man_s west_east = 100001001; - 100 001 001 south_north = 100001100; - 100 001 100 man_w = 10; man_s west_east(0)= not west_east(0); west_east(3)= not west_e

16、ast(3); south_north = 100001100; - 100 001 100 man_w = 10; man_s west_east = 100010010; - 100 010 010 south_north = 100001100; - 100 001 100 man_w = 10; man_s west_east = 110100100; - 110 100 100 south_north = 100001100; - 100 001 100 man_w = 10; man_s = 10; end case; else if rush_w=0 then -the emer

17、gency car signal of the west and the east -which is superior to the south and the north west_east = 001100100; - 001 100 100 south_north = 100100100; - 100 100 100 man_w = 10; man_s = 10; elsif rush_s=0 then -the emergency car signal of the south and the north west_east = 100100100; -100 100 100 sou

18、th_north = 001100100; - 001 100 100 man_w = 10; man_s = 10; else NULL; end if; end if;end if;end process;end architecture do;3、 变量说明输入端口:rst -复位,高电平有效clk2 -2Hz 时钟脉冲rush_w -东西方向急车按键,低电平有效rush_s -南北方向急车按键,低电平有效输出端口:west_east -东西方向控制灯,从左至右为中间灯、右转灯、左转灯。均为红黄绿。man_w -东西方向人行道灯,为红绿。south_north -南北方向控制灯,从左至右

19、为中间灯、右转灯、左转灯。均为红黄绿。man_s -南北方向人行道灯,为红绿。信号:State -状态is_normal -运行模式控制信号,正常时为1;急车时为0。count -计时器clk -1Hz 信号4、 选择器件,并编译。4.程序调试及分析1、仿真,得到结果如下:正常运行时:有急车时(单一方向):有急车时(两个方向同时):2、分配端口、并下载到器件中。3、通过对时序图分析可知该交通灯可以完成交通控制。5.讨论及进一步研究建议1、 在程序中如果有定义了但未使用的端口或信号时,程序编译时会产生奇怪的错误,编译不了。所以,使用的端口或变量要把它注释掉。2、 在软件仿真时,时钟的周期不要取太

20、小,若开始在仿真时取时钟周期为10ns,将会产生很奇怪的波形,则可能走不少的弯路。3、 在交通灯的显示模块,选择在显示时采用2Hz的信号,通过二分频的进程,得到1Hz的计时时钟,同时实现交通灯的闪烁。4、 Max+plusII经常会产生很多奇怪的错误,而且,它给出的提示又极其简单,需要我们多编程、多熟悉Max+plusII这个VHDL的编译仿真环境。6.综合设计性实验心得在这次实验中,通过程序的设计和上机调试,让我巩固地掌握了VHDL语言实现电路逻辑功能的基本应用,了解了软件MAX+PLUSII的使用,也让我了解了如何建立时序图和对时序图分析的方法。要完满地完成这个设计性实验,就必须对可编程逻

21、辑器件这门课的基本理论加以琢磨,要做到真正理解,同时要掌握VHDL语言的基本应用及相关语言现象的用法。刚开始实验的时候,我很快就完成了程序的输入,却发现仿真结果与理论值之间存在着一定的差异,通过调试和不断的摸索,最终完成了实验。通过这次设计实验学习,我熟悉了交通灯的工作原理,自己动手实践,使我掌握了MAX+PLUSII基本软件的使用,理解并掌握了较复杂逻辑的设计、调试、数字电路模块的层次设计,以及功能分割方法,对于这次设计实验,我更注重实验的过程而不是结果,因为它让我对所学的知识有了更为深刻的理解。参考文献1.EDA技术实用教程(第二版) 潘松,黄继业.2006 科学出版社2.EDA实验指导书 电子信息工程教研室

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

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1