0
\$\begingroup\$

What I want is two LED lights and a push button. When the push button is pressed the first time, the first light lights up. When it's pressed a second time, the second light lights up. When it's pressed a third time, both lights turn off.

I set up two D flip flops. The first Q output connects to the second's D input. The push button is hooked to the Clock on both flip flops, the push button which is hooked to a power source. After going through my logic with K-maps, I determined the following:

D1 = Q0'Q1 D0 = Q0'

Q0 is the first flip flop and Q1 is the second flip flops.

So I set up the gates as necessary.

Here is where the problem is. The lights have a strange behavior. Sometimes one turns on, sometimes both turns on. I'm obviously doing something wrong.

\$\endgroup\$
1
\$\begingroup\$

While I'm not a Multisim guy, I suggest that you haven't tied D0 to any thing. Try tieing D0 to a logic high.

Furthermore, I suspect that your description means that, the sequence of LEDs should look like

Start Q0 off, Q1 off Push Q0 on, Q1 off Push Q0 off, Q1 on Push Q0 off, Q1 off Push Q0 on, Q1 off Push Q0 off, Q1 on Push Q0 off, Q1 off etc.

If this is so, you need a second input - Start, to force the FFs to the starting position. This may not be true for Multisim, as the program may initialize FFs to 0, but you would need it in real life. Assuming that no Start is needed,

schematic

simulate this circuit – Schematic created using CircuitLab

will do. Obviously, if a batter has one strike and gets a hit or a walk, you can push the button twice more to get back to the starting state.

\$\endgroup\$
  • \$\begingroup\$ Turns out D0 did need a logic high. I got it working finally, but through a means I wouldn't have thought of before. I ended using an extra D flip flop, then when that has a stored 1 and the button is pushed, everything resets. \$\endgroup\$ – Peter Griffin Mar 18 '15 at 1:20
1
\$\begingroup\$

You may be experiencing switch bounce from your push button. Look for filter circuits that will eliminate switch bounce. The simplest just add a small capacitor and a resistor to the circuit.

\$\endgroup\$
  • \$\begingroup\$ It's in Multisim, which doesn't have switch bounce. \$\endgroup\$ – Austin Mar 17 '15 at 2:05
0
\$\begingroup\$

The proper connections would be D0=(Not)Q1 and D1=Q0*(Not)Q1. This will create the sequence you are looking for.

\$\endgroup\$
  • \$\begingroup\$ Also you should make sure your clock signal is debounced, you could be clocking through more than one step per button press. \$\endgroup\$ – Bill Mar 17 '15 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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