Asynchronous Traffic Lights

Thread Starter

infinityCounter

Joined Nov 7, 2015
4
So I'm making a traffic light circuit where the lights stay on for varying time length, Green for 60 seconds, amber for 5, and red for 30, for a total of 95 seconds. The most complicated pre-constructed component I can use is a flip flop, other than that, LEDs, and a clock, and a seven segment display, basic gates only.

So The solution I came up with sets 5 JK flip flops, 4 representing a 4 bit number, and one for the other, to count from 0 to 19, with clock at 0.2hz. This would normally be 100 seconds, however I have a and and nor gate in place that checks if the number is currently 18, and or's it with the clock. I was hoping this would reset the counter except it just freezes I'm not sure why. Also I set a myriad of logic gates to determine when an LED should be on or not, but non of them energized. I have attached photos of my circuit, project shee any help would be much obliged.question.png lights.png
 

WBahn

Joined Mar 31, 2012
29,979
Don't expect people giving free assistance to wade through a mish-mash rat's nest schematic. Make your work presentable.

Walk through your design -- don't expect others to reverse engineer your work.

Your LEDs are only connected to a single node. How can they ever light up?

What are these 1A current sources doing in your schematic?
 

Thread Starter

infinityCounter

Joined Nov 7, 2015
4
Don't expect people giving free assistance to wade through a mish-mash rat's nest schematic. Make your work presentable.

Walk through your design -- don't expect others to reverse engineer your work.

Your LEDs are only connected to a single node. How can they ever light up?

What are these 1A current sources doing in your schematic?
Sorry about that, I'm using workbench 5.12 and it just seems to throw the line however it wants, but I tried best I could to space them out. I'm a newbie and my teacher didn't explain anything beyond basic logic gates so I'm not sure how to get the LED's to energize. The 1A current source was because when I did the k-map for one of the jk flip flops it was always true, or 1, so I just figured directly connecting it to a power supply would do the trick.

update, thanks I followed your advice and connected the LED's to a ground and now they energize, not exactly in the order I wanted but that's obviously a logic error on my part. Though I'm still not sure why the circuit freezes.
 
Last edited:

WBahn

Joined Mar 31, 2012
29,979
You can use a voltage source to get your logic HI, but you need to use the correct voltage. I have no idea how Workbench handles that. You do NOT want to use a current source. In the real world a 1 A current source will produce whatever voltage, within its capabilities, is necessary to push 1 A of current into the circuit. Bye-bye logic gates.

Most logic simulators have specific parts for applying a logic LO or a logic HI to a signal line.

Your freezing problem is being caused because you are gating your clock. It is going into an OR gate along with another signal. As soon as that other signal goes HI, then it masks the clock.

Gated clocks are bad ju-ju.

Word of advice -- never design asynchronous circuits unless you are prepared to do some serious timing hazard analysis on them. Instead, design fully-synchronous circuits in which your clock signal goes directly to the clock inputs of all of your clocked chips and you do not use asynchronous set/clear on anything. As you gain experience you can relax those guidelines, but for now you will save yourself lots of grief by staying fully synchronous.
 
Top