This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

hi friends please help me out with this..

My project is based on traffic lights control system. i use 4 infrared sensors as input and 12 leds (4 lanes) 4 red, 4 yellow and 4 green leds as outputs.

My questions is

1. Can i write the code in both embedded c and few interrupts in assemply language programming??

2.i want to giv a special condition like-

if 3 vehicles are sensed then green light should glow for 5 seconds,                                                                                if 6 vehicles are sensed then green light should glow for 10 seconds and so on.. how can i give this condition?? please help me with the coding..

  • Arun Kumar5 said:
    Can i write the code in both embedded c and few interrupts in assemply language programming??

    Yes, if you so desire. You could also write the interrupts in C and keep the whole project in one language.

    Arun Kumar5 said:
    I want to give a special condition like-

      - if 3 vehicles are sensed then green light should glow for 5 seconds,

      - if 6 vehicles are sensed then green light should glow for 10 seconds and so on..

    how can i give this condition??

    Not being quite clear on how you sense how many vehicles, it's hard to tell you exactly how to do this. But... I would probably implement the controller as a state machine. When in the "Detect Vehicles" state, use the number of vehicles detected to decide whether to transition to the "Green for 5 seconds" or the "Green for 10 seconds" state. Either of those then transition to whatever the next state is after the appropriate time.

    The timing of when to check sensors and transition states / lights could be done in the ISR of a Timer. Set the timer duration appropriately at each state transition.

  • Hey Arun,

    I would like to Just add one thing to what Brian had said.

    If you wanna have a advice on your alogorithm, it is advicable to posta simple flow chart of what you are thinking to do. This facilitates us, to know what you really want to do and can then suggest you the feasable way.

    Anyway.

    Assuming, ur vechile sensing method is some thing like multiple button press phenomenon.
    YOu need to do is glow a LED when there were four button presses. 

    If my presumption was right then, all you need to do is :

    Enter in to ISR on first Button press event
    Check if there were other port IFG's?
    Check if there were enough required IFG's to take action ?
    Decide to turn the corrsponding light?
    Cheers.



  • hi friends, i have sent the sample flow chart of my project. Please someone write that in a embedded c or msp430 assembly language program. Reply as soon as possilbe please

    6574.flow chart for traffic control1.docx

    Thank you

  • Arun Kumar5 said:
    Please someone write that in a embedded c or msp430 assembly language program. Reply as soon as possilbe please

    I think you will find some good guidance in the third sentence of this article.

    Also, Getting things quickly.

    Come back with specific questions about what you can't get working in your code.

  • Arun Kumar5 said:
    hi friends, i have sent the sample flow chart of my project. Please someone write that in a embedded c or msp430 assembly language program.

    This forum is not for such kind of requests. You can try URLs mentioned here

    Arun Kumar5 said:
    Reply as soon as possilbe please

    Apologies. I tried to reply as fast as I can.

  • No way possible that you are in charge of a designing real traffic light system.
    If it is then hire someone competent and certified to do the work.

    The traffic situation is a very common homework assigned by teachers,
    and we don't tell the answers here for your own good.

**Attention** This is a public forum