交通控制器eda課程設計
㈠ EDA技術課程設計———交通燈控制器
圖書館有書啊
㈡ 用EDA設計交通燈控制器的設計
ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity top_traffic is
port( clock : in std_logic;
reset : in std_logic;
chip1 : in std_logic;
chip2 : in std_logic;
seg_out : out std_logic_vector(6 downto 0);
chip_sel : out std_logic;
chip_sel1 : out std_logic;
chip_sel2 : out std_logic;
q_out : out std_logic_vector(11 downto 0)
);
end ;
architecture bhv of top_traffic is
component qhz_any
port( clk: in std_logic;
Q: out std_logic
);
end component;
component qhz_any1
port( clk: in std_logic;
Q: out std_logic
);
end component;
component mux21a
port( s : in std_logic;
a,b : in std_logic_vector(6 downto 0);
y : out std_logic_vector(6 downto 0)
);
end component;
component traffic
port( clk : in std_logic;
rst : in std_logic;
times : out integer range 0 to 100;
q : out std_logic_vector(11 downto 0);
shi: out std_logic_vector(6 downto 0);
ge: out std_logic_vector(6 downto 0)
);
end component;
signal m1 : std_logic;
signal m2 : std_logic;
signal m3 : integer range 0 to 100;
signal m4 : std_logic_vector(6 downto 0);
signal m5 : std_logic_vector(6 downto 0);
begin
u1 : qhz_any port map(clk=>clock,Q=>m1);
u2 : qhz_any1 port map(clk=>clock,Q=>m2);
u3 : qhz_any1 port map(clk=>clock,Q=>chip_sel);
u4 : traffic port map(clk=>m1,times=>m3,q=>q_out,rst=>reset,ge=>m4,shi=>m5);
u5 : mux21a port map(a=>m4,b=>m5,y=>seg_out,s=>m2);
chip_sel1<=chip1;
chip_sel2<=chip2;
end bhv;
-------------miao fenpin-----------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity qhz_any is
generic(n:integer:=20000000);
port( clk: in std_logic;
Q: out std_logic);
end qhz_any;
architecture bhv of qhz_any is
begin
process(clk)
variable cout:integer:=0;
begin
if clk'event and clk='1' then
if cout<(n/2) then
Q<='1'; cout:=cout+1;
elsif cout<(n-1) then
Q<='0'; cout:=cout+1;
else cout:=0;
end if;
end if;
end process;
end bhv;
----------------scan fenpin-----------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity qhz_any1 is
generic(n:integer:=200000);
port( clk: in std_logic;
Q: out std_logic);
end qhz_any1;
architecture bhv of qhz_any1 is
begin
process(clk)
variable cout:integer:=0;
begin
if clk'event and clk='1' then
if cout<(n/2) then
Q<='1'; cout:=cout+1;
elsif cout<(n-1) then
Q<='0'; cout:=cout+1;
else cout:=0;
end if;
end if;
end process;
end bhv;
--------------------traffic-------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity traffic is
port( clk : in std_logic;
rst : in std_logic;
times : out integer range 0 to 100;
q : out std_logic_vector(11 downto 0);
shi,ge:out std_logic_vector(6 downto 0));
end traffic;
architecture bhv of traffic is
signal cnt : integer range 0 to 100;
signal l1,l2:integer range 0 to 9;
type state_value is (s1,s2,s3,s4);
signal state : state_value;
begin
process(clk,rst)
begin
if rst='1' then
state<=s1; --S,N travel E,W stop
cnt<=39;
q<="100001100001";
elsif rising_edge(clk) then
case state is
when s1=> --s1
if cnt=0 then
state<=s2;
q<="100010100010";
cnt<=4;
else
state<=s1;
cnt<=cnt-1;
end if;
when s2=> --s2
if cnt=0 then
state<=s3;
q<="001100001100";
cnt<=44;
else
state<=s2;
cnt<=cnt-1;
end if;
when s3=> --s3
if cnt=0 then
state<=s4;
q<="010100010100";
cnt<=4;
else
state<=s3;
cnt<=cnt-1;
end if;
when s4=> --s4
if cnt=0 then
state<=s1;
q<="100001100001";
cnt<=39;
else
state<=s4;
cnt<=cnt-1;
end if;
end case;
end if;
end process;
l1<=cnt/10; l2<=cnt rem 10;---- JI SUAN SHI WEI ; GE WEI
process(l1)
begin
case l1 is ------- XIAN SHI SHI WEI
when 0=>shi<="1111110"; --0
when 1=>shi<="0110000"; --1
when 2=>shi<="1101101"; --2
when 3=>shi<="1111001"; --3
when 4=>shi<="0110011"; --4
when 5=>shi<="1011011"; --5
when 6=>shi<="1011111"; --6
when 7=>shi<="1110000"; --7
when 8=>shi<="1111111"; --8
when 9=>shi<="1111011"; --9
end case;
end process;
process(l2)
begin
case l2 is -------- XIAN SHI GE WEI
when 0=>ge<="1111110"; --0
when 1=>ge<="0110000"; --1
when 2=>ge<="1101101"; --2
when 3=>ge<="1111001"; --3
when 4=>ge<="0110011"; --4
when 5=>ge<="1011011"; --5
when 6=>ge<="1011111"; --6
when 7=>ge<="1110000"; --7
when 8=>ge<="1111111"; --8
when 9=>ge<="1111011"; --9
end case;
end process;
end bhv;
---------------------------2 xuan 1-----------
library ieee;
use ieee.std_logic_1164.all;
entity mux21a is
port( s : in std_logic;
a,b : in std_logic_vector(6 downto 0);
y : out std_logic_vector(6 downto 0)
);
end mux21a;
architecture one of mux21a is
begin
process(a,b,s)
begin
if s='0' then y<=a; else y<=b;
end if;
end process;
end one;
~~自己用過的,時間根據你的改過了,11點就熄燈,沒時間寫特殊情況了,自己先看看哦
㈢ 課程設計EDA交通信號燈
PLC的我有,這個還真沒得
㈣ EDA課程設計
用單片機或者存儲器.
如果不允許用,可以這樣,整個過程分成24步,每步0.5秒。用幾回個個4017計數器,完成計答數,然後用二極體矩陣完成解碼,而且單片機的I/O就有鎖存功能一般不用加,你可以用164來擴展I/O口,他也可以鎖存的,宏晶的網站上有參考的電路圖,你可以去看看.
㈤ EDA 交通控制器的設計
一、JTDKZ
假設4種狀態分別為:A、B、C、D,在CLK上升沿來時,根據SB、SM狀態判斷交通處於何種狀態,該狀態輸出什麼信號。
設計的原理圖模塊:
設計源程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY JTDKZ IS
PORT(CLK,SM,SB:IN STD_LOGIC;
MR,MY0,MG0,BR,BY0,BG0:OUT STD_LOGIC);
END ENTITY JTDKZ;
ARCHITECTURE ART OF JTDKZ IS
TYPE STATE_TYPE IS(A,B,C,D);
SIGNAL STATE:STATE_TYPE;
BEGIN
CNT:PROCESS(CLK)IS
VARIABLE S:INTEGER RANGE 0 TO 45;
VARIABLE CLR,EN:BIT;
BEGIN
IF(CLK'EVENT AND CLK='1')THEN
IF CLR='0'THEN S:=0;
ELSIF EN='0'THEN S:=S;
ELSE S:=S+1;
END IF;
CASE STATE IS
WHEN A=>MR<='0';MY0<='0';MG0<='1';BR<='1';BY0<='0';BG0<='0';
IF(SB AND SM)='1' THEN
IF S=45 THEN STATE<=B;CLR:='0';EN:='0';
ELSE STATE<=A;CLR:='1';EN:='1';
END IF;
ELSIF(SB AND(NOT SM))='1'THEN STATE<=B;CLR:='0';EN:='0';
ELSE STATE<=A;CLR:='1';EN:='1';
END IF;
WHEN B=>MR<='0';MY0<='1';MG0<='0';BR<='1';BY0<='0';BG0<='0';
IF S=5 THEN STATE<=C;CLR:='0';EN:='0';
ELSE STATE<=B;CLR:='1';EN:='1';
END IF;
WHEN C=>MR<='1';MY0<='0';MG0<='0';BR<='0';BY0<='0';BG0<='1';
IF(SM AND SB)='1'THEN
IF S=25 THEN STATE<=D;CLR:='0';EN:='0';
ELSE STATE<=C;CLR:='1';EN:='1';
END IF;
ELSIF SB='0' THEN STATE<=D;CLR:='0';EN:='0';
ELSE STATE<=C;CLR:='1';EN:='1';
END IF;
WHEN D=>MR<='1';MY0<='0';MG0<='0';BR<='0';BY0<='1';BG0<='0';
IF S=5 THEN STATE<=A;CLR:='0';EN:='0';
ELSE STATE<=D;CLR:='1';EN:='1';
END IF;
END CASE;
END IF;
END PROCESS CNT;
END ARCHITECTURE ART;
設計模擬的截圖:
二、XSKZ
根據EN45、EN25、EN05M、EN05B的信號以及3個倒計時計數器的計數狀態決定輸出3個倒計時計數器中某個的狀態輸出。
原理圖模塊:
設計源程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY XSKZ IS
PORT(EN45,EN25,EN05M,EN05B: IN STD_LOGIC;
AIN45M,AIN45B,AIN25M,AIN25B,AIN05: IN STD_LOGIC_VECTOR(7 downto 0);
DOUTB,DOUTM: OUT STD_LOGIC_VECTOR(7 downto 0));
END ENTITY XSKZ;
ARCHITECTURE ART OF XSKZ IS
SIGNAL A :STD_LOGIC_VECTOR (3 DOWNTO 0);
begin
A<= EN45&EN25&EN05M&EN05B;
PROCESS(A) IS
BEGIN
CASE A IS
WHEN"1000"=>DOUTM<=AIN45M;DOUTB<=AIN45B;
WHEN"1010"=>DOUTM<=AIN05;DOUTB<=AIN05;
WHEN"0100"=>DOUTM<=AIN25M;DOUTB<=AIN25B;
WHEN"0101"=>DOUTM<=AIN05;DOUTB<=AIN05;
WHEN OTHERS=>DOUTM<="00000000";DOUTB<="00000000";
END CASE ;
END PROCESS;
END ARCHITECTURE ART;設計模擬的截圖:
三、CNT45S
CLK上升沿到來時,若到計時使能信號和SB信號有效,CNT45S開始計數,並將輸入狀態通過DOUT45M、DOUT45B分別輸出到主、支幹道顯示。
設計的原理圖模塊:
設計源程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY CNT45S IS
PORT(SB,CLK,EN45:IN STD_LOGIC;
DOUT45M,DOUT45B:OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END CNT45S;
ARCHITECTURE ART OF CNT45S IS
SIGNAL CNT6B:STD_LOGIC_VECTOR(5 DOWNTO 0);
BEGIN
PROCESS(SB,CLK,EN45) IS
BEGIN
IF SB='0' THEN CNT6B<=CNT6B-CNT6B-1;
ELSIF(CLK'EVENT AND CLK='1')THEN
IF EN45='1'THEN CNT6B<=CNT6B+1;
ELSIF EN45='0'THEN CNT6B<=CNT6B-CNT6B-1;
END IF;
END IF;
END PROCESS;
PROCESS(CNT6B)IS
BEGIN
CASE CNT6B IS
WHEN"000000"=>DOUT45M<="01000101";DOUT45B<="01010000";
WHEN"000001"=>DOUT45M<="01000100";DOUT45B<="01001001";
WHEN"000010"=>DOUT45M<="01000011";DOUT45B<="01001000";
WHEN"000011"=>DOUT45M<="01000010";DOUT45B<="01000111";
WHEN"000100"=>DOUT45M<="01000001";DOUT45B<="01000110";
WHEN"000101"=>DOUT45M<="01000000";DOUT45B<="01000101";
WHEN"000110"=>DOUT45M<="00111001";DOUT45B<="01000100";
WHEN"000111"=>DOUT45M<="00111000";DOUT45B<="01000011";
WHEN"001000"=>DOUT45M<="00110111";DOUT45B<="01000010";
WHEN"001001"=>DOUT45M<="00110110";DOUT45B<="01000001";
WHEN"001010"=>DOUT45M<="00110101";DOUT45B<="01000000";
WHEN"001011"=>DOUT45M<="00110100";DOUT45B<="00111001";
WHEN"001100"=>DOUT45M<="00110011";DOUT45B<="00111000";
WHEN"001101"=>DOUT45M<="00110010";DOUT45B<="00110111";
WHEN"001110"=>DOUT45M<="00110001";DOUT45B<="00110110";
WHEN"001111"=>DOUT45M<="00110000";DOUT45B<="00110101";
WHEN"010000"=>DOUT45M<="00101001";DOUT45B<="00110100";
WHEN"010001"=>DOUT45M<="00101000";DOUT45B<="00110011";
WHEN"010010"=>DOUT45M<="00100111";DOUT45B<="00110010";
WHEN"010011"=>DOUT45M<="00100110";DOUT45B<="00110001";
WHEN"010100"=>DOUT45M<="00100101";DOUT45B<="00110000";
WHEN"010101"=>DOUT45M<="00100100";DOUT45B<="00101001";
WHEN"010110"=>DOUT45M<="00100011";DOUT45B<="00101000";
WHEN"010111"=>DOUT45M<="00100010";DOUT45B<="00100111";
WHEN"011000"=>DOUT45M<="00100001";DOUT45B<="00100110";
WHEN"011001"=>DOUT45M<="00100000";DOUT45B<="00100101";
WHEN"011010"=>DOUT45M<="00011001";DOUT45B<="00100100";
WHEN"011011"=>DOUT45M<="00011000";DOUT45B<="00100011";
WHEN"011100"=>DOUT45M<="00010111";DOUT45B<="00100010";
WHEN"011101"=>DOUT45M<="00010110";DOUT45B<="00100001";
WHEN"011110"=>DOUT45M<="00010101";DOUT45B<="00100000";
WHEN"011111"=>DOUT45M<="00010100";DOUT45B<="00011001";
WHEN"100000"=>DOUT45M<="00010011";DOUT45B<="00011000";
WHEN"100001"=>DOUT45M<="00010010";DOUT45B<="00010111";
WHEN"100010"=>DOUT45M<="00010001";DOUT45B<="00010110";
WHEN"100011"=>DOUT45M<="00010000";DOUT45B<="00010101";
WHEN"100100"=>DOUT45M<="00001001";DOUT45B<="00010100";
WHEN"100101"=>DOUT45M<="00001000";DOUT45B<="00010011";
WHEN"100110"=>DOUT45M<="00000111";DOUT45B<="00010010";
WHEN"100111"=>DOUT45M<="00000110";DOUT45B<="00010001";
WHEN"101000"=>DOUT45M<="00000101";DOUT45B<="00010000";
WHEN"101001"=>DOUT45M<="00000100";DOUT45B<="00001001";
WHEN"101010"=>DOUT45M<="00000011";DOUT45B<="00001000";
WHEN"101011"=>DOUT45M<="00000010";DOUT45B<="00000111";
WHEN"101100"=>DOUT45M<="00000001";DOUT45B<="00000110";
WHEN OTHERS=>DOUT45M<="00000000";DOUT45B<="00000000";
END CASE;
END PROCESS;
END;
設計模擬的截圖:
4、CNT25S
CLK上升沿到來時,若到計時使能信號、SM信號和SB信號有效,CNT25S開始計數,並將輸入狀態通過DOUT25M、DOUT25B分別輸出到主、支幹道顯示。
設計的原理圖模塊:
設計源程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY CNT25S IS
PORT(SB,SM,CLK,EN25:IN STD_LOGIC;
DOUT25M,DOUT25B:OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END ENTITY CNT25S;
ARCHITECTURE ART OF CNT25S IS
SIGNAL CNT5B:STD_LOGIC_VECTOR(4 DOWNTO 0);
BEGIN
PROCESS(SB,SM,CLK,EN25)IS
BEGIN
IF SB='0'THEN CNT5B<=CNT5B-CNT5B-1;
ELSIF SM='0'THEN CNT5B<=CNT5B-CNT5B-1;
ELSIF(CLK'EVENT AND CLK='1')THEN
IF EN25='1'THEN CNT5B<=CNT5B+1;
ELSIF EN25='0'THEN CNT5B<=CNT5B-CNT5B-1;
END IF;
END IF;
END PROCESS;
PROCESS(CNT5B)IS
BEGIN
CASE CNT5B IS
WHEN"00000"=>DOUNT25B<="00100101";DOUT25M<="00110000";
WHEN"00001"=>DOUNT25B<="00100100";DOUT25M<="00101001";
WHEN"00010"=>DOUNT25B<="00100011";DOUT25M<="00101000";
WHEN"00011"=>DOUNT25B<="00100010";DOUT25M<="00100111";
WHEN"00100"=>DOUNT25B<="00100001";DOUT25M<="00100110";
WHEN"00101"=>DOUNT25B<="00100000";DOUT25M<="00100101";
WHEN"00110"=>DOUNT25B<="00011001";DOUT25M<="00100100";
WHEN"00111"=>DOUNT25B<="00011000";DOUT25M<="00100011";
WHEN"01000"=>DOUNT25B<="00010111";DOUT25M<="00100010";
WHEN"01001"=>DOUNT25B<="00010110";DOUT25M<="00100001";
WHEN"01010"=>DOUNT25B<="00010101";DOUT25M<="00100000";
WHEN"01011"=>DOUNT25B<="00010100";DOUT25M<="00011001";
WHEN"01100"=>DOUNT25B<="00010011";DOUT25M<="00011000";
WHEN"01101"=>DOUNT25B<="00010010";DOUT25M<="00010111";
WHEN"01110"=>DOUNT25B<="00010001";DOUT25M<="00010110";
WHEN"01111"=>DOUNT25B<="00010000";DOUT25M<="00010101";
WHEN"10000"=>DOUNT25B<="00001001";DOUT25M<="00010100";
WHEN"10001"=>DOUNT25B<="00001000";DOUT25M<="00010011";
WHEN"10010"=>DOUNT25B<="00000111";DOUT25M<="00010010";
WHEN"10011"=>DOUNT25B<="00000110";DOUT25M<="00010001";
WHEN"10100"=>DOUNT25B<="00000101";DOUT25M<="00010000";
WHEN"10101"=>DOUNT25B<="00000100";DOUT25M<="00001001";
WHEN"10110"=>DOUNT25B<="00000011";DOUT25M<="00001000";
WHEN"10111"=>DOUNT25B<="00000010";DOUT25M<="00000111";
WHEN"11000"=>DOUNT25B<="00000001";DOUT25M<="00000110";
WHEN OTHERS=>DOUNT25B<="00000000";DOUT25M<="00000000";
END CASE;
END PROCESS;
END;
設計模擬的截圖:
5、CNT05S
簡單思路:CLK上升沿到來時,若到計時使能信號有效,CNT25S開始計數,並將輸入狀態通過DOUT05輸出到主、支幹道顯示。
設計的原理圖模塊:
設計源程序
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY CNT05S IS
PORT(CLK,EN05M,EN05B:IN STD_LOGIC;
DOUT5:OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END CNT05S;
ARCHITECTURE ART OF CNT05S IS
SIGNAL CNT3B:STD_LOGIC_VECTOR(2 DOWNTO 0);
BEGIN
PROCESS(CLK,EN05M,EN05B)IS
BEGIN
IF(CLK'EVENT AND CLK='1')THEN
IF EN05M='1'THEN CNT3B<=CNT3B+1;
ELSIF EN05B='1'THEN CNT3B<=CNT3B+1;
ELSIF EN05B='0'THEN CNT3B<=CNT3B-CNT3B-1;
END IF;
END IF;
END PROCESS;
PROCESS(CNT3B)
BEGIN
CASE CNT3B IS
WHEN"000"=>DOUT5<="00000101";
WHEN"001"=>DOUT5<="00000100";
WHEN"010"=>DOUT5<="00000011";
WHEN"011"=>DOUT5<="00000010";
WHEN"100"=>DOUT5<="00000001";
WHEN OTHERS=>DOUT5<="00000000";
END CASE;
END PROCESS;
END;
設計模擬的截圖:
6、YMQ
七段解碼顯示器,輸出0~9的數據在顯示屏上。
設計的原理圖模塊:
設計源程序
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY YMQ IS
PORT(AIN4:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
DOUT7: OUT STD_LOGIC_VECTOR(6 DOWNTO 0));
END ENTITY YMQ;
ARCHITECTURE ART OF YMQ IS
BEGIN
PROCESS(AIN4) IS
BEGIN
CASE AIN4 IS
WHEN "0000"=>DOUT7<="0111111";
WHEN "0001"=>DOUT7<="0000110";
WHEN "0010"=>DOUT7<="1011011";
WHEN "0011"=>DOUT7<="1001111";
WHEN "0100"=>DOUT7<="1100110";
WHEN "0101"=>DOUT7<="1101101";
WHEN "0110"=>DOUT7<="1111101";
WHEN "0111"=>DOUT7<="0000111";
WHEN "1000"=>DOUT7<="1111111";
WHEN "1001"=>DOUT7<="1101111";
WHEN OTHERS=>DOUT7<="0000000";
END CASE;
END PROCESS;
END ARCHITECTURE ART;
http://dept.xgu.cn/sfzx/wlkt/shiyan12.files/frame.htm#slide0150.htm
㈥ EDA課設交通燈信號控制器介面設計
MODEL TINY MAX_N equ 34049 STACK_LENequ32 _TEXTsegment;byte public 'CODE ' org 100h _mainprocnear @:jmp@100 @43: ;out loop header movsi,6 xorcx,cx ; cmp[si],cx jnz@44 ; pushsi lodsw ; @43_5: lodsw;[si]--> ax mov[si-4],ax cmpsi,bp jbe @43_5 ; popsi addword ptr [si-2],4;[0004]+=4 decbp decbp ;cx still is 0 ;si still point to 6 @44: ;inner loop header movword ptr ax,[si] mulbx; *= i addax,cx; +=carry adcdx,0 @45: divdi ;save current digital movword ptr [si],dx ;save current digtial to buff incsi incsi movcx,ax;move carry to cx xordx,dx cmp si,bp jbe@44 or ax,ax jnz@45 @46: leabp,[si-2];calc end ime=62
㈦ 用VHDL語言設計一個交通燈,EDA課程設計
首先最簡單的方法是列出真值表。寫出邏輯表達式。然後根據邏輯表達式來寫出vhdl程序。在編譯=》模擬=》功能分析=》輸出延時=》下載程序 1.設計原理
在這個實例中,我們設計一個簡單的十字路口交通燈。交通燈分東西和南北兩個方向,均通過數碼管和指示燈指示當前的狀態。設兩個方向的流量相當,紅燈時間45s,綠燈時間40s,黃燈時間5s.
從交通燈的工作機理來看,無論是東西方向還是南北方向,都是一個減法計數器。只不過計數時還要判斷紅綠燈情況,再設置計數器的模值。
下表所示為一個初始狀態和4個跳變狀態。交通燈工作時狀態將在4個狀態間循環跳變,整個交通燈則完全按照減計數器原理進行設計。
狀態 當前計數值 下一個CLOCK到來時新模值
東西方向指示 南北方向指示 東西-南北方向指示 東西方向指示 南北方向指示 東西-南北方向指示
初始 0 0 45 40 紅-綠
1 6 1 紅-綠 5 5 紅-黃
2 1 1 紅-黃 40 45 綠-紅
3 1 6 綠-紅 5 5 黃-紅
4 1 1 45 40 紅-綠
2.部分程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity traffic is
port(clk, urgency: in std_logic;
east_west:buffer std_logic_vector(7 downto 0);--東西方向時鍾計數
south_north: buffer std_logic_vector(7 downto 0); --南北方向的時鍾計數
led:buffer std_logic_vector(5 downto 0)); --交通指示燈
end traffic;
architecture arch of traffic is
。。。。。。。
end arch;
3.具體設計步驟
1) 建立一個新的工程完成上面的電路設計
2) 編譯電路並使用功能模擬來驗證設計
3) 引腳配置,如Part I中討論的,這些配置是確保VHDL代碼中輸出埠能使用PFGA晶元上連接到LEDR和LEDG的引腳。重新編譯項目,並下載到FPGA晶元上。
4) 測試電路的正確性。
㈧ 關於EDA課程設計交通指示燈
這個我以前寫的,是T形路口,z1,z2,z3(c1,c2,c3)分別是主路(支路)口的紅黃路燈,先是支路放行20s,再是主路放行40s,紅燈到路燈中間要有5s黃燈,路燈直接到黃燈,和你需要的差不多。自己看看改改就行,電路圖也很簡單的去網路查查
library ieee;
use ieee.std_logic_1164.all;
entity lude is
port(clk:in bit;
z1,c1,z2,c2,z3,c3:out bit);
end entity;
architecture one of lude is
begin
process(clk)
VARIABLE TEMP1: NATURAL;
begin
if(clk'event and clk='1') then
temp1:=temp1+1;
if temp1<=20 then
z1<='1';z2<='0';z3<='0';c1<='0';c2<='0';c3<='1';
elsif temp1<=25 then
z1<='0';z2<='1';z3<='0';c1<='0';c2<='0';c3<='1';
elsif temp1<=65 then
z1<='0';z2<='0';z3<='1';c1<='1';c2<='0';c3<='0';
elsif temp1<=70 then
z1<='0';z2<='0';z3<='1';c1<='0';c2<='1';c3<='0';
elsif temp1>70 then
temp1:=0;
end if;
end if;
end process;
end;
㈨ eda課程設計 地鐵自動售票機控制系統的設計
地鐵自動售票機控制的
要求是什麼
任務是什麼