8051 traffic light

Discussion in 'Embedded Systems and Microcontrollers' started by hyman, Dec 27, 2007.

  1. hyman

    Thread Starter New Member

    Dec 27, 2007
    3
    0
    Please help I need a traffic light code in C , i have in Assembly but want the C using Ride Ide to debug and run.

    Thanks
     
  2. hyman

    Thread Starter New Member

    Dec 27, 2007
    3
    0
    Please help I need a traffic light Source code in C , i have it in Assembly but want the C using Ride Ide to debug and run.

    Thanks
     
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    We heard you the first time.

    Are you looking for the C programming language, or do you want someone to just give you the C code as a completed project?
     
  4. hyman

    Thread Starter New Member

    Dec 27, 2007
    3
    0
    Yes I just needed the C code for a traffic light
     
  5. Pootworm

    Member

    May 18, 2007
    29
    0
    I believe a standard traffic engineering algorithm contains the following snippet:

    Code ( (Unknown Language)):
    1.  
    2. ...
    3.  
    4. while( true ) {
    5.  
    6.   setLight( LIGHT_RED );
    7.  
    8.   if( isHeadingToWork( pootworm ) || isLowOnGas( pootworm ) ) {
    9.     delay( 1000 );
    10.   }
    11.   else {
    12.     delay ( 5 );
    13.   }
    14.  
    15. ...
    16.  
    17.  
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Some more effort on your part is called for. You may not get any more code than the snippet pootworm contributed. Code-on-demand is not the purpose of these forums.

    We will help, but you need to actually do the work. If you have the traffic light control function in assembler, then duplicating it in C sounds a bit busy. Is there some problem with the assembler code? We might be able to help with that.
     
Loading...