Friday, 12 September 2014

Traffic light controller by VHDL with FPGA

Traffic light controller by VHDL by FPGA :- 

TRAFFIC  LIGHT  CONTROLLER   IN  VHDL:-

OBJECTIVE:-
                   This project is used for control the traffic at a circle. At the circle the traffic will be flow and stop by the three lights.

VHDL CODE :- 
-----------------------------------------------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity trafica is
    Port ( clk : in  STD_LOGIC;
           p2 : out  STD_LOGIC_vector(11 downto 0) );
end trafica;


architecture functions of trafica is
begin

process(clk)
variable m:std_logic_vector(24 downto 0):=(others=>'0');
variable n : integer := 0 ;
variable p1 : std_logic_vector(11 downto 0);

begin
if(rising_edge(clk))then
if(m < "1011111010111100001000000")then
m:=m+1;
else
m:=(others=>'0');
n := n + 1;
end if;
end if;

if(n = 1 )then
p1(2 downto 0) := "001";
p1(5 downto 3):= "100";
p1(8 downto 6) := "100";
p1(11 downto 9) := "100";
end if ;

 if( n = 11 )then
p1(2 downto 0) := "010";
 end if ;

 if (n = 14)then
 p1(2 downto 0) := "100";
p1(5 downto 3) := "001";
 end if ;

if (n = 25)then
 p1(2 downto 0) := "100";
p1(5 downto 3) := "010";
 end if ;

 if (n = 29)then
 p1(2 downto 0) := "100";
p1(5 downto 3) := "100";
p1(8 downto 6) := "001";
 end if ;

 if (n = 40)then
 p1(2 downto 0):= "100";
p1(5 downto 3):= "100";
p1(8 downto 6) := "010";
 end if ;

 if(n = 44 )then
p1(2 downto 0) := "100";
p1(5 downto 3) := "100";
p1(8 downto 6) := "100";
p1(11 downto 9) := "001";
end if ;

IF(n = 55 )then
p1(2 downto 0) := "100";
p1(5 downto 3) := "100";
p1(8 downto 6) := "100";
p1(11 downto 9) := "010";
end if ;

if(n = 59 )then
 n  := 0;
end if ;

p2<= p1;

end process;
end functions;


-------------------------------------------------------------------------------------------------




SAMPLE IMAGE:-


















Features :-
·         It uses a counter so user can change the time for a particular way.
·         It uses a clock pulse at which every rising edge it gives the output.
·         In this project we take the three output while input is one .

DESCRIPTION:-

·         In this project we use behavioral modeling style by if else statement.


Syntax of if else statement


if <condition> then

statements
...

[
elsif <condition> then

statements
...
else

statements
...

]

End if;

·         We gives a clock pulse at a input so that it gives the output at a every rising edge of clock.
·         For the four way we makes a four counter .
·         At the output we takes the three output of std_logic_vector (3 downto 0) for the four ways.
·         Counter takes a increment in present value at a every rising edge of clock .

COMPONENTS REQUIRED:-
       I.            Xilinx Prject navigator(6.1)
    II.            Modelsim 5.4
 III.            Spartan 3e kit FPGA board

WORKS TO DO IN REQUIRED ORDER:-
                               I.            We installed the project navigator software in computer with include modelsim 5.4.
                            II.            We makes a integer counter for a particular time period .
                         III.            A integer counter counts the values in integer formate.
                         IV.            Now open a single way at a time instat while all others are close .
                            V.            Now we run this code at project navigator and improve the errors and after that check the RTL.
                         VI.            Now burn the code in FPGA kit .


-------------------------------------------------------------------------------------------------

For more details please mail us  at   vlsiengitech@gmail.com or call us :- 09649955929

For B.Tech / M.tech Thesis and projects 






1 comment: