# How does a flip-flop work? - unknown state

1. Jan 9, 2014

### alexmath

I'm having trouble understanding how a simple flip flop circuit works. Firstly - can a logic gate work only connected with one wire?
I don't actually understand what happen's when you press a button inside the circuit when the circuit is in the unknown state. When the circuit is in a stable position, all is clear, but when we wire up the wires and we set it for the first time then it does not makes sense... I want to know what's happening with the flip flop in the picture below. Sorry for my poor english grammar. Thank you!

File size:
35.6 KB
Views:
219
2. Jan 9, 2014

### .Scott

The logic gates are connected through several wires.
Aside from the input and outputs that are shown, each one also has a power line and ground.

When the flip flop devices shown are first powered up, two possible stable states are possible. Either the Nand gate can be "on" or the And gate is on. in practice, any given flip flop will almost always power up in the same state every time. But when you design a circuit that uses a flip flop, you cannot depend on its state until you pulse one of its two inputs.

3. Jan 9, 2014

### CWatters

The image you posted shows three circuits that illustrate two slightly different problems...

In the top circuit one input is not connected. That should never be done because the voltage on that input might float to any level. It might float to a voltage that is not a valid logic 1 or 0. In which case the output is said to be undefined. It could be a 1, 0, some value in between or even oscillate . You would have to look at the circuit inside the gate and treat it as an analogue device to know what the output would do. A bit of noise somewhere in the circuit might make it impossible to know for sure.

The other circuits illustrate a slightly different problem. Some time after the power rails are within spec the output of the flip flop will be found to be in one of two states. Which state it will be is undefined. However if you wait long enough it will eventually settle on a valid logic level even if you don't know which logic level that will be.

It's good practice to add another input to latches and flip flops to force the output to a known state on power up. This is usually connected to a signal called "Reset" or "Power ON Reset" which can be generated using an RC circuit like this...

http://www.renesas.com/media/support/faqs/faq_results/Q1000000-Q9999999/por1.gif [Broken]

If you don't do this then you have to check that the output every latch or flip flop doesn't matter after a power failure. You wouldn't want something like a saw mill to start up on it's own after a brief power cut!

http://en.wikipedia.org/wiki/Power-on_reset

Last edited by a moderator: May 6, 2017
4. Jan 10, 2014

### donpacino

the diagram you included represents a latch, not a flip flop. a flip flop is comprised of multiple latches. In the latch, typically one input is referred to as the reset line, and one is the set line. when using digital circuitry you ALLWAYS reset the circuit before using it. this gets rid of the unknown state problem.