EDA技術(shù)與FPGA應(yīng)用設(shè)計交通燈控制器_第1頁
EDA技術(shù)與FPGA應(yīng)用設(shè)計交通燈控制器_第2頁
EDA技術(shù)與FPGA應(yīng)用設(shè)計交通燈控制器_第3頁
EDA技術(shù)與FPGA應(yīng)用設(shè)計交通燈控制器_第4頁
EDA技術(shù)與FPGA應(yīng)用設(shè)計交通燈控制器_第5頁
已閱讀5頁,還剩4頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、 本科課程設(shè)計報告課程名稱: eda技術(shù)與fpga應(yīng)用設(shè)計 設(shè)計項目: 交通燈控制器 實驗地點: cpld實驗室 指導(dǎo)教師: 張文愛 2016 年 5月24日一、設(shè)計要求設(shè)計一個由一條主干道和一條支干道的十字路口的交通燈控制器,具體要求如下:(1) 主、支干道各設(shè)有一個綠、黃、紅指示燈,兩個顯示數(shù)碼管。(2) 主干道處于常允許通行狀態(tài),而支干道有車來才允許通行。當主干道允許通行亮綠燈時,支干道亮紅燈。而支干道允許通行亮綠燈時,主干道亮紅燈。 (3) 當主、支道均有車時,兩者交替允許通行,主干道每次放行45 s,支干道每次放行25 s,由亮綠燈變成亮紅燈轉(zhuǎn)換時,先亮5 s的黃燈作為過渡,并進行減

2、計時顯示。二、設(shè)計方案(1) 設(shè)置支干道有車開關(guān)sb。(2) 系統(tǒng)中要求有45秒、25秒和5秒三種定時信號,需要設(shè)計三種相應(yīng)的計時顯示電路。計時方法為倒計時。定時的起始信號由主控電路給出,定時時間結(jié)束的信號輸入到主控電路。(3) 主控制電路的輸入信號一方面來自車輛檢測,另一方面來自45秒、25秒、5秒的定時到信號;輸出有計時啟動信號(置計數(shù)起始值)和紅綠燈驅(qū)動信號。狀態(tài)轉(zhuǎn)移如圖所示,用狀態(tài)機描述。三、設(shè)計步驟1.編寫各個模塊的vhdl程序。2.上機調(diào)試優(yōu)化程序。3.程序合成器件模塊,并連接原理圖。4.編寫并下載程序,進行硬件實現(xiàn)。四、模塊結(jié)構(gòu)五、模塊源程序1. jtdkzlibrary iee

3、e;use ieee.std_logic_1164.all;entity jtdkz is port(clk,sb,cnt,rst:in std_logic; en,mr,my,mg,br,by,bg: out std_logic; din:out std_logic_vector(7 downto 0);end entity jtdkz;architecture art of jtdkz is type state_type is(a,b,c,d); signal p_state,n_state: state_type; beginreg:process(clk,rst) is begin

4、if rst=1 then p_state=a; elsif(clkevent and clk=1)then p_statemr=0; my=0; mg=1; br=1; by=0; bg=0; if(sb and cnt)=1 then n_state=b; din=00000101; en=0; else n_state=a; din=01000101; enmr=0; my=1; mg=0; br=1; by=0; bg=0; if cnt=1 then n_state=c; din=00100101; en=0; else n_state=b; din=01000101; enmr=1

5、; my=0; mg=0; br=0; by=0; bg=1; if cnt=1 then n_state=d; din=00000101; en=0; else n_state=c; din=01000101; enmr=1; my=0; mg=0; br=0; by=1; bg=0; if cnt=1 then n_state=a;din=01000101; en=0; else n_state=d; din=01000101; en=1; end if;end case;end process com;end architecture art;2.jsqlibrary ieee;use

6、ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity jsq is port(en, rst: in std_logic; din: in std_logic_vector(7 downto 0); clk:in std_logic; cnt: out std_logic; qh, ql:buffer std_logic_vector(3 downto 0) ); end entity jsq;architecture art of jsq isbegincnt=1 when (qh=0000 and ql=0000)

7、else 0; process(clk,en,rst) beginif rst=1 then qh=0100;ql=0101;elsif clkevent and clk=1 then if en=0 then qh=din(7 downto 4); ql=din(3 downto 0);elsif ql=0 then ql=1001; if qh=0 then qh=1001; else qh=qh-1; end if; else ql=ql-1; end if; end if;end process;end architecture art;library ieee;use ieee.st

8、d_logic_1164.all;use ieee.std_logic_unsigned.all;entity work1 isport (clk : in std_logic;rst:in std_logic;ena:in std_logic;outy:out std_logic_vector(3 downto 0);cout:out std_logic);end work1;architecture behav of work1 issignal cqi: std_logic_vector(3 downto 0);beginp_reg:process(clk,rst,ena)beginif rst = 1then cqi = 0000;elsif clk event and clk = 1thenif ena = 1then cqi = cqi + 1;end if;end if;outy = cqi;end process p_reg;cout led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7s led7snull;end case;end

溫馨提示

  • 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論