implementation of traffic light...

Discussion in 'VHDL' started by danddad61@gmail.com, May 24, 2013.

  1. Guest

    hi all,
    i'm new in the area of vhdl.
    and i need to do a traffic light that turn the red light for 10 second.
    the yellow light to 4 second and the green light for 2 seconds.
    it's maybe sound simple program in vhdl.
    but who can help me and say how to program it.
    and what is the machine statement for this.
    thank's all...
    , May 24, 2013
    #1
    1. Advertising

  2. On 24 Mai, 13:39, wrote:
    > and i need to do a traffic light that turn the red light for 10 second.
    > the yellow light to 4 second and the green light for 2 seconds.


    Tell your teacher that no one needs such a ridicoluos bad traffic
    light. He missed a yellow phase between green and red, together with
    only 2 sec green this will lead to horrible traffic jams.

    > it's maybe sound simple program in vhdl.
    > but who can help me and say how to program it.


    architecture programm of trafficjam is
    type traffic_light_t is (red, green, yellow);
    begin
    program: process
    variable traffic_light is traffic_light_type;
    begin
    traffic_light := red;
    wait for 10 sec;
    traffic_light=yellow;
    wait for 4 sec;
    traffic_light = green;
    wait for 2 sec;
    end process;

    > and what is the machine statement for this.
    > thank's all...


    You sure you will manage to do the following steps to your master of
    copy&paste yourself?

    best regards

    Thomas
    Thomas Stanka, May 24, 2013
    #2
    1. Advertising

  3. Guest

    Hi Thomas,
    first of all thank's for the fast reply.
    i don't know also why he want such a traffic light.
    about your program...
    i don't need to initialize an entity at all?
    something like:
    entity lights is
    port (CLK: in STD_LOGIC;
    GO_GREEN: in STD_LOGIC;
    GO_RED: in STD_LOGIC;
    GO_YELLOW: in STD_LOGIC;
    LIGHT_GREEN: out STD_LOGIC;
    LIGHT_RED: out STD_LOGIC;
    LIGHT_YELLOW: out STD_LOGIC);
    end;
    and what the circle that the traffic light need to do?
    when the green light finish he need to go back to be red and so on...
    how he do that in your code? and how i do it in real?
    and what about a clk, i don't need to use one for geting a real seconds?

    thank's
    dan
    , May 24, 2013
    #3
  4. John Speth Guest

    On 5/24/2013 7:34 AM, wrote:
    > Hi Thomas,
    > first of all thank's for the fast reply.
    > i don't know also why he want such a traffic light.
    > about your program...
    > i don't need to initialize an entity at all?
    > something like:
    > entity lights is
    > port (CLK: in STD_LOGIC;
    > GO_GREEN: in STD_LOGIC;
    > GO_RED: in STD_LOGIC;
    > GO_YELLOW: in STD_LOGIC;
    > LIGHT_GREEN: out STD_LOGIC;
    > LIGHT_RED: out STD_LOGIC;
    > LIGHT_YELLOW: out STD_LOGIC);
    > end;
    > and what the circle that the traffic light need to do?
    > when the green light finish he need to go back to be red and so on...
    > how he do that in your code? and how i do it in real?
    > and what about a clk, i don't need to use one for geting a real seconds?


    This is the part where you get to do the work now. Mr Stanka threw you
    a very generous bone. He probably already has his EE degree. It's time
    for you to earn yours.

    I recommend you experiment and iterate using a test bench simulator.
    That's where you'll find your answers.

    JJS
    John Speth, May 24, 2013
    #4
  5. On 24 Mai, 16:34, wrote:
    > Hi Thomas,
    > first of all thank's for the fast reply.
    > i don't know also why he want such a traffic light.
    > about your program...
    > i don't need to initialize an entity at all?


    You always need an entity. Don't expect me to write basics down for
    you. The code from me is not even syntactically correct.

    You asked for a program, and I gave you one. It will do what is needed
    include looping infinite, but you cannot expect this to be simple
    converted into real hardware.

    To get real hardware you would need first to learn the difference
    between a program (software) and a circuit (hardware). If you don't
    know these differences, and understand why there is a reason to have
    both possibilities in VHDL you will have a hard time till you have
    your first own circuit running.

    If you think about a circuit, you need to think about hardware
    representations for time, lightbulbs, and so one. But why would this
    circuit traffic light have some inputs called "go_green"?
    This is a question to be answered by the guy who invents the system.
    If you like me to invent your system, you should be able to pay me.
    Else it will be your task.

    > and what about a clk, i don't need to use one for geting a real seconds?


    Yes you will need a source that allows you to tell, when a second has
    passed. This can be a (precise) clock for your design, or an cyclic
    pulse that is not used as clock in your design, but represents a clock
    on system level.

    bye Thomas
    Thomas Stanka, May 26, 2013
    #5
  6. rickman Guest

    On 5/24/2013 10:34 AM, wrote:
    > Hi Thomas,
    > first of all thank's for the fast reply.
    > i don't know also why he want such a traffic light.
    > about your program...
    > i don't need to initialize an entity at all?
    > something like:
    > entity lights is
    > port (CLK: in STD_LOGIC;
    > GO_GREEN: in STD_LOGIC;
    > GO_RED: in STD_LOGIC;
    > GO_YELLOW: in STD_LOGIC;
    > LIGHT_GREEN: out STD_LOGIC;
    > LIGHT_RED: out STD_LOGIC;
    > LIGHT_YELLOW: out STD_LOGIC);
    > end;
    > and what the circle that the traffic light need to do?
    > when the green light finish he need to go back to be red and so on...
    > how he do that in your code? and how i do it in real?
    > and what about a clk, i don't need to use one for geting a real seconds?
    >
    > thank's
    > dan


    I don't know what grade you will get, but I think your professor should
    get an F for how poorly he has prepared you for this assignment. If you
    don't understand VHDL well enough to know what is happening in the
    program Thomas gave you and what the problems are with using it, there
    is no chance you will complete this assignment.

    What book are you using? Where are you in the book. What has been
    covered in class so far?

    Here is a hint... "wait for xxx sec;" is not synthesizable in hardware.
    So you need to think of another way of controlling the timing. If you
    weren't using an HDL, but were designing this using schematics, how
    would you control the timing?

    --

    Rick
    rickman, May 27, 2013
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hammer

    Traffic light

    Hammer, Jun 15, 2006, in forum: VHDL
    Replies:
    10
    Views:
    4,364
    Hammer
    Jun 15, 2006
  2. Hammer

    Traffic light complete!

    Hammer, Jun 15, 2006, in forum: VHDL
    Replies:
    8
    Views:
    11,189
    JULIOSOL
    May 25, 2007
  3. deelok
    Replies:
    0
    Views:
    1,023
    deelok
    Oct 26, 2007
  4. Dan

    traffic light controller

    Dan, Nov 17, 2007, in forum: VHDL
    Replies:
    2
    Views:
    1,045
  5. Michael Tsang
    Replies:
    32
    Views:
    1,115
    Richard Bos
    Mar 1, 2010
Loading...

Share This Page