Electronic – Why does the D Flip Flop Circuit have an X output

clockflipflop

I'm working on one of my projects and I'm having trouble with my flip flops. The project is to design the circuit for a gas pump that has a handle and a sensor. When the handle is down, the pump pumps, but when the sensor is activated, the pump shuts off. It will pump again until a second high pressure is read, at which point the pump shuts down completely until a manual reset is done (not part of the project). I'm working on the Mealey design since it's a little smaller.

Essentially, when my handle is high and my sensor is low, I'm getting an X for my output and I don't know why. I hope someone can provide some input:

Here is everything I have for it:

enter image description here
enter image description here
enter image description here
enter image description here
enter image description here

Alright, I added the reset. Now I'm getting that my states change every time my clock changes. Any ideas?:

enter image description here

Best Answer

Seems to me like your flip flops need to have a reset value.

When power is applied to a DFF at "time=0", the output state is X, or unknown. A reset is needed to bring the DFF to a known state.

In your case, check out the FF DB. It's input is:

(DB && !DA) || (Sensor && !DB && DA). 

When I substitute your time zero values into this I get:

= (X && !X) || (0 && X && X)
= ( X || 0 )
= X

So until something happens that actually forces the inputs to a non-X value, the circuit will have an X state forever. A 'reset' would typically be used to clear the Xs.