EDA課程設(shè)計實驗報告交通信號燈控制_第1頁
EDA課程設(shè)計實驗報告交通信號燈控制_第2頁
EDA課程設(shè)計實驗報告交通信號燈控制_第3頁
EDA課程設(shè)計實驗報告交通信號燈控制_第4頁
EDA課程設(shè)計實驗報告交通信號燈控制_第5頁
已閱讀5頁,還剩11頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、hunan university 課程設(shè)計實驗報告課題:交通信號燈控制 學(xué)院:電氣與信息工程學(xué)院姓名: 班級:電氣工程及其自動化(3)班 學(xué)號:一、課程設(shè)計的要求及目的:1了解電子設(shè)計的具體流程和方法。2. 掌握電子設(shè)計的基本要求,能夠運(yùn)用所學(xué)的知識解決生活中的一些問題。3. 初步掌握vhdl語言編程,并設(shè)計出一個有意義的小型系統(tǒng)。4. 掌握altium designer6軟件的應(yīng)用,并且了解相關(guān)硬件的組成和功能。5. 用eda(electronic design automation)或者原理圖完成一個課題的設(shè)計,并達(dá)到相應(yīng)的功能要求。二、設(shè)計的功能要求:眾所周知,隨著生活的進(jìn)步,我們身邊的

2、交通也日益繁忙,在眾多的十字交叉路口,為了確保車輛安全,迅速地通行,就必須在每個入口設(shè)置紅綠燈。本系統(tǒng)中設(shè)置了紅,綠,黃三色共三種信號燈。紅燈亮禁止一切該方向的行人和車輛通行,綠燈亮允許行人和車輛通行,黃燈亮則提示行駛中的車輛注意不要搶道,并讓它們有時間停靠到禁行線之外或者加快通過,同時提醒行人加快行進(jìn)或者等待下一次綠燈。人行道燈亮?xí)r,允許行人通過。本交通信號燈控制系統(tǒng)以東西,南北方向走向的十字路口為例講述設(shè)計的功能要求和設(shè)計的具體過程1、 用八個發(fā)光二極管作信號指示燈。順序為東西主干道紅、綠、黃、人行燈,南北主干道紅、綠、黃、人行燈。2、考慮到?jīng)]有設(shè)置到車輛的轉(zhuǎn)彎信號指示燈,而且作為交通繁忙

3、的交通干道,為了節(jié)省車輛的等待時間,所以設(shè)置了紅燈亮的時間為45s,綠燈亮和人行燈亮的時間均為40s,黃燈亮的時間為5s。當(dāng)東西方向的干道禁止通行時,該干道亮紅燈,南北方向干道亮綠燈,同時南北方向的人行道燈亮;當(dāng)南北方向的干道轉(zhuǎn)變?yōu)辄S燈閃爍時,進(jìn)入了黃燈警示時間,黃燈閃爍結(jié)束以后,東西方向干道亮綠燈允許通行,同時東西方向的人行道燈亮,南北方向的紅燈亮,人行道燈滅;當(dāng)東西方向干道轉(zhuǎn)變?yōu)辄S燈閃爍時,進(jìn)入黃燈警示時間,黃燈閃爍結(jié)束以后,東西方向干道亮紅燈,人行道燈滅,南北方向亮綠燈亮,人行道燈亮。如此反復(fù)進(jìn)行,當(dāng)遇到緊急(故障)情況時候,進(jìn)入到緊急狀態(tài)。3、該信號控制系統(tǒng)的初始狀態(tài)為東西方向主干道亮

4、紅燈(45s),南北方向主干道亮綠燈(40s)和人行燈,黃燈滅。指示牌會顯示出45和40兩個數(shù)字。4、 交通燈正常運(yùn)行時,用數(shù)字顯示器顯示東西、南北兩主干道允許通過的剩余時間(采用倒計時的形式顯示ascii數(shù)字)。5、當(dāng)出現(xiàn)故障的時候,此時東西,南北兩方向主干道均亮紅燈,數(shù)字顯示管均停止計數(shù)并將當(dāng)前的停留時間和錯誤信號(eeee)輪流顯示。故障解除后能返回正常工作狀態(tài)(復(fù)位后為初始狀態(tài))。6、 能實現(xiàn)系統(tǒng)手動復(fù)位,復(fù)位后回到初始狀態(tài),并從初始狀態(tài)開始倒計時。三、設(shè)計方案選擇由于該交通控制電路比較復(fù)雜,用現(xiàn)有庫元器件可能導(dǎo)致耗用較多器件且其功能又不能完全達(dá)到設(shè)計要求,還可能出現(xiàn)其他的意想不到的情

5、況,造成電路復(fù)雜,設(shè)計困難,難以排錯等問題。而由于該系統(tǒng)的狀態(tài)有限而且簡單可以一一列舉,故采用狀態(tài)機(jī)設(shè)計方案。狀態(tài)機(jī)設(shè)計使得設(shè)計更為簡單明了,系統(tǒng)容錯能力也大為提升,而且狀態(tài)機(jī)順序控制靈活,結(jié)構(gòu)簡單,便于修改,同時其對付競爭冒險的現(xiàn)象能力很強(qiáng),運(yùn)行速度快,使其成為數(shù)字系統(tǒng)設(shè)計中的重要部分,也是調(diào)高效率的重要途徑。因此本次設(shè)計采用狀態(tài)機(jī)的vhdl描述,生成相應(yīng)的器件模塊。最后將器件模塊和少數(shù)的庫元件有機(jī)的結(jié)合在一起,構(gòu)成總的原理圖,從而形成了交通燈控制系統(tǒng)。而在本次交通燈的控制電路設(shè)計中,一共設(shè)置有六種狀態(tài),分別為s1(初始狀態(tài)),s2,s3,s4為正常工作狀態(tài);s5,s6為故障時候的狀態(tài)。四、

6、 設(shè)計思路和框架分析 1.交通路口位置東 :人行過道 :紅綠黃燈:人行過道燈南北 西 2、狀態(tài)表狀態(tài)東西主干道南北主干道指示燈亮燈時間指示燈亮燈時間s1紅燈亮45s綠燈亮40ss2紅燈亮黃燈亮5ss3綠燈亮40s紅燈亮45ss4黃燈亮5s紅燈亮s5紅燈亮當(dāng)前時間紅燈亮當(dāng)前時間s6紅燈亮ee紅燈亮ee3、狀態(tài)轉(zhuǎn)換圖復(fù) 位s1s2s4s3按復(fù)位鍵s6s5故 障五、交通燈的控制電路的vhdl程序1.主控制電路模塊的程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_log

7、ic_arith.all;entity traffic light is port ( hold:in std_logic; reset: in std_logic; clk: in std_logic; ah: out std_logic_vector (3 downto 0); al: out std_logic_vector (3 downto 0); bh: out std_logic_vector (3 downto 0); bl: out std_logic_vector (3 downto 0); l: out std_logic_vector (7 downto 0) );en

8、d traffic light;architecture a of traffic light istype state_type is (s1,s2,s3,s4,s5,s6); signal s: state_type; signal n,m: std_logic; signal a,b,c,d,tah,tal,tbh,tbl:std_logic_vector (3 downto 0);begin zt:process(clk,hold,reset) variable snow:state_type; begin if reset='1' then tbh<="

9、;0100"tah<="0100" tbl<="0000"tal<="0101" n<='0' s<=s1; elsif clk='1' and clk 'event then if hold='1' then if s/=s5 and s/=s6 then s<=s5; a<=tah; b<=tal; c<=tbh; d<=tbl; elsif s=s5 then s<=s6; else if n=&#

10、39;0' then n<='1' tah<="1111" tbh<="1111" tal<="1111" tbl<="1111" else n<='0' tah<=a;tal<=b;tbh<=c;tbl<=d; end if; end if; elsif n='0' then n<='1' else n<='0' case s is when s1=>

11、; if tbh="0000" and tbl="0001" and tah="0000" and tal="0110" then s<=s2 ;snow:=s2; tbl<="0101" tal<=tal-1; else if tal="0000" then tal<="1001" tah<=tah-1; else tal<=tal-1; end if; if tbl="0000" then tbl

12、<="1001" tbh<=tbh-1; else tbl<=tbl-1; end if; end if; when s2=>if tal=1 and tbl=1 then s<=s3;snow:=s3; tah<="0100"tal<="0000"tbh<="0100"tbl<="0101" else tal<=tal-1;tbl<=tbl-1; end if; when s3=> if tah="0000&qu

13、ot; and tal="0001" and tbh="0000" and tbl="0110" then s<=s4 ;snow:=s4; tal<="0101" tbl<=tbl-1; else if tal="0000" then tal<="1001" tah<=tah-1; else tal<=tal-1; end if; if tbl="0000" then tbl<="1001"

14、tbh<=tbh-1; else tbl<=tbl-1; end if; end if; when s4=>if tbl=1 and tal=1 then s<=s1;snow:=s1; tah<="0100"tal<="0101"tbh<="0100"tbl<="0000" else tal<=tal-1;tbl<=tbl-1; end if; when s5=>s<=s6; when s6=>s<=snow; tah<=a

15、;tal<=b;tbh<=c;tbl<=d; when others=>null; end case; end if; end if; end process zt; process(tah) begin ah<=tah; end process; process(tal) begin al<=tal; end process; process(tbh) begin bh<=tbh; end process; process(tbl) begin bl<=tbl; end process; shch:process(s,n) begin case

16、 s is when s1=>l<="10000101" when s2=>if n='0' then l<="10000010" else l<="10000000" end if; when s3=>l<="01011000" when s4=>if n='0' then l<="00101000" else l<="00001000" end if; when s5=>l&

17、lt;="10001000" when s6=>l<="10001000" end case;end process shch;end a;由上述的程序生成的器件模塊如下圖:其中clk為時鐘脈沖信號, reset為復(fù)位信號,hold為故障輸入信號。l是交通信號燈信號的輸出,al,ah, bl, bh都是二進(jìn)制bcd碼輸出。當(dāng)reset為1時,返回到s1狀態(tài)在clk為上升沿且hold為1時,顯示為故障狀態(tài)也即s5和s6狀態(tài)。2.譯碼電路器件模塊由于上述模塊輸出的是bcd二進(jìn)制碼,而altium designer6 下載模塊上的數(shù)字顯示管輸入是a

18、scii碼,故,還需要一個編譯電路模塊作為譯碼輸出轉(zhuǎn)換電路。譯碼電路器件模塊的程序如下:library ieee;use ieee.std_logic_1164.all;entity coding is port( bcd_in : in std_logic_vector(3 downto 0); asc_out : out std_logic_vector(7 downto 0);end coding;architecture structure of coding issignal asc_out_reg :std_logic_vector(7 downto 0);begin asc_ou

19、t <= asc_out_reg; process(bcd_in) begin case bcd_in is when"0000"=> asc_out_reg<=x"30" when"0001"=> asc_out_reg<=x"31" when"0010"=> asc_out_reg<=x"32" when"0011"=> asc_out_reg<=x"33" when"

20、0100"=> asc_out_reg<=x"34" when"0101"=> asc_out_reg<=x"35" when"0110"=> asc_out_reg<=x"36" when"0111"=> asc_out_reg<=x"37" when"1000"=> asc_out_reg<=x"38" when"1001"

21、=> asc_out_reg<=x"39" when others=> asc_out_reg<=x"45" end case; end process;end structure;形成譯碼器電路器件形式如下:3.lcd控制器 采用altium designer6 下載模塊上的lcd1602數(shù)字顯示管顯示倒計時數(shù)字,向lcd輸入的數(shù)據(jù)為ascii碼,需要通過數(shù)碼掃描依次送到lcd顯示,仍需編譯一塊lcd控制器ip核lcd16x2a的程序。lcd控制器的程序如下:library ieee;use ieee.std_logic_116

22、4.all;entity lcd_scan is port( clk_in: in std_logic; rstn_in: in std_logic; ascii_1_in: in std_logic_vector(7 downto 0); ascii_2_in: in std_logic_vector(7 downto 0); ascii_3_in: in std_logic_vector(7 downto 0); ascii_4_in : in std_logic_vector(7 downto 0); busy_in : in std_logic; data_out: out std_l

23、ogic_vector(7 downto 0); addr_out: out std_logic_vector(3 downto 0); line_out: out std_logic; strobe_out: out std_logic );end lcd_scan;architecture art of lcd_scan istype m_state is( ready, lcd_1_out, lcd_1_strobe, lcd_1_wait, lcd_2_out, lcd_2_strobe, lcd_2_wait, lcd_3_out, lcd_3_strobe, lcd_3_wait,

24、 lcd_4_out, lcd_4_strobe, lcd_4_wait );signal data_out_reg : std_logic_vector(7 downto 0); signal addr_out_reg : std_logic_vector(3 downto 0); signal line_out_reg : std_logic;signal strobe_out_reg : std_logic;begin data_out <= data_out_reg; addr_out <= addr_out_reg; line_out <= line_out_reg

25、; strobe_out <= strobe_out_reg; process(clk_in) variable state: m_state; begin if clk_in'event and clk_in = '0' then if rstn_in = '0' then state := ready; else if busy_in = '0' then case state is when ready => state := lcd_1_out; data_out_reg <= x"00" a

26、ddr_out_reg <= x"0" line_out_reg <= '1' strobe_out_reg <= '0' when lcd_1_out => state := lcd_1_strobe; data_out_reg <= ascii_1_in; addr_out_reg <= x"f" when lcd_1_strobe => state := lcd_1_wait; strobe_out_reg <= '1' when lcd_1_wait

27、=> state := lcd_2_out; strobe_out_reg <= '0' when lcd_2_out => state := lcd_2_strobe; data_out_reg <= ascii_2_in; addr_out_reg <= x"e" when lcd_2_strobe => state := lcd_2_wait; strobe_out_reg <= '1' when lcd_2_wait => state := lcd_3_out; strobe_out_r

28、eg <= '0' when lcd_3_out => state := lcd_3_strobe; data_out_reg <= ascii_3_in; addr_out_reg <= x"d" when lcd_3_strobe => state := lcd_3_wait; strobe_out_reg <= '1' when lcd_3_wait => state := lcd_4_out; strobe_out_reg <= '0' when lcd_4_out =&

29、gt; state := lcd_4_strobe; data_out_reg <= ascii_4_in; addr_out_reg <= x"c" when lcd_4_strobe => state := lcd_4_wait; strobe_out_reg <= '1' when lcd_4_wait => state := lcd_1_out; strobe_out_reg <= '0' state := ready; end case; else state := state; strobe_o

30、ut_reg <= '0' end if; end if; end if; end process; end art;形成lcd控制器器件形式如下:4.綜合電路圖在進(jìn)行仿真模擬時,所用仿真輸入的時鐘脈沖信號周期是4ns,下載到硬件上時,為了能夠觀察到所要求的燈光信號,輸入脈沖信號定為2hz(用于保證黃燈閃爍的觀測),由于模板上最小的脈沖為10mhz,所以要采用分頻器。5.綜合仿真結(jié)果:心得體會經(jīng)過為其兩周的課程設(shè)計,本人受益匪淺。這是我們自己大學(xué)三年以來自己第一次動手設(shè)計自己的東西,而不僅僅是停留在理論上。這一次的課程設(shè)計讓我懂得了理論的指導(dǎo)意義,同時也深深知道自己實際動手能力的缺乏,深深認(rèn)識到加強(qiáng)自己的理論指導(dǎo)實踐的能力的緊迫性和重要性。選了交通燈控制這一小項目,因為它很簡單,很容易的就用原理圖或者狀態(tài)機(jī)設(shè)計完成。這是我選擇它的最重要的原因。但是看是簡單的交通燈控制,卻讓我明白,要想靠自己成功的完成,還得老老實實的花大力氣去做。剛開始,由于altium designer 6這軟件對我來說完全陌生

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論