Electronic – Digital Circuit with Toggle Switch using Logisim

digital-logicflipfloplatchlogisim

I'm supposed to design a small digital circuit (with Logisim) using basic logic gates, so that when this circuit is used with the chosen switch (which has to be a button), it will make the circuit function as a toggle switch.

So when I press the button it turns on the LED display(the output) and when I press it again it turns off.

http://imgur.com/H0lgj1c is what I've so far but it's not working and I don't seem to understand why. Can someone please help me out?

Thanks

Best Answer

It looks like your latches woke up in the unknown 'X' state, and the complement of X is another X. For your simulation to work you need a way to initialize the latches in a valid logic state, either 0 or 1. Sorry, but I'm not sure how to do this in Logisim other than adding a separate reset input to your circuit. Perhaps you can specify an initial state in the properties for each gate.

Of course, in real life the latch will wake up in either a 0 or a 1 state and the toggle will work as expected. This is a common artifact of digital logic simulations...unknown values propagate pessimisticly...and you soon learn that it's best to have an explicit reset for the storage elements.