0
\$\begingroup\$

I've been trying to get a traffic light simulation working on Logisim but I've run into some issues.

The way the circuit works is that I default to the green light, and when I press a button (represented as a pin), I switch to the yellow light for two clock cycles and then to the red light for eight cycles before going all the way back to the green light and waiting for the button to be pressed again.

The way both the yellow lights work is with a counter (either set to 1 or 3 bits) with a clock as the clock signal. The output of the counter goes to a decoder that checks for the last digit (either 1 or 7) and connects it to the data input in a T flip-flop, and the Q output of that flip-flop corresponds to the light in question.

Here's my current implementation:

Here's my current implementation

I have all the individual components working, but I was wondering how I could break the cycle for the yellow and red lights, to cycle to the next light (yellow to red) or to restart completely (red to green).

EDIT: Here follows the ASM graph I have designed for this circuit Note: There are two circuits to be implemented, and in this post I am only referring to the Vehiche's circuit, because I feel like the transition between states would work similarly even if in different circuits. ASM Model of the circuit

\$\endgroup\$
27
  • \$\begingroup\$ It isn't clear to me, yet. In one place you write about a yellow light. But later say "both the yellow lights" which reads as a plural to me (more than one.) Also, it sounds like you have just one push button to use. And that it triggers movement to the yellow light, then movement to the red light, then movement back to the green light. Same button? Or different buttons? The schematic I see above doesn't look at all right to me. But perhaps just because it is done as individual sections. Is it that these need to be combined in some way? If so, why didn't you combine them? Not enough training? \$\endgroup\$ Jan 17 at 23:58
  • \$\begingroup\$ @periblepsis its just a single button for those interactions, and yes, I did not connect them because I can't figure out how to, that is why I made the post in the first place. Additionally, the circuit is composed of a Green light, a Yellow light and a Red light, and I'm trying to go in between them. \$\endgroup\$
    – ramwen0
    Jan 18 at 0:06
  • \$\begingroup\$ Have you developed any kind of state table for this? Or are you just operating completely in the dark about how to proceed on it? I'm both shocked and not-shocked about education these days. But I would like to know what you can and cannot manage on your own, so that I have a foundation to work from if I decide to try helping. \$\endgroup\$ Jan 18 at 0:07
  • \$\begingroup\$ I did not, because I had no clue on how to, and thought it'd be easier to just start trying out circuits in Logisim. I did make an ASM model for it though. As soon as I read the description I wasn't sure on how I could proceed with a state table, so I went on to Logisim directly... \$\endgroup\$
    – ramwen0
    Jan 18 at 0:08
  • \$\begingroup\$ It might help if you posted up what you have. Everything you have produced that might help clarify. And an abstract state machine model would definitely help clarify details. \$\endgroup\$ Jan 18 at 0:09

1 Answer 1

0
\$\begingroup\$

This won't be a solution for you. Quite frankly, I don't know what would be a solution since you can't describe the problem in sufficient detail.

But let's say that the flow was something like this:

enter image description here

It stays in the top state until a pedestrian presses their button. Then it immediately transitions to the next stage. At the end, vehicles are guaranteed at least 8 cycles of green before the pedestrian button is again observed.

If so, the following might satisfy me:

enter image description here

The clock is blocked when in the initial state until the PED button is pressed. Once that happens, nothing can interrupt the cycle until it is completed. Then and only then can the PED button be once again observed to trigger another cycle.

You may watch the MP4 here. (One cycle per second.)

I'm offering this to get you focused on defining your problem. It's not defined well, yet. But perhaps the above will show enough to suggest certain ways/approaches that can be used to solve problems similar to this one.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.