2
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ "It will pump again until a second high pressure is read": do you mean if handle goes to zero and then to 1 again? In other words, how is the pump restarted after first shut-off? \$\endgroup\$ Apr 8, 2013 at 23:07
  • \$\begingroup\$ If I understand your question correctly, then yes. Once a high pressure is read while the handle is pulled, the pump goes to 0. The handle must be released and pressed again in order to start pumping until a second high pressure is read. At which point, you cannot pump again. \$\endgroup\$
    – rphello101
    Apr 8, 2013 at 23:27
  • 1
    \$\begingroup\$ If I understand your drawing, your "Handle" input connects only to the AND gate at lower right. And the output of that AND gate goes nowhere. So I don't see any way for the Handle input to affect the state machine. \$\endgroup\$
    – The Photon
    Apr 9, 2013 at 0:46
  • \$\begingroup\$ @The Photon, because this is a Mealey design where the the states are as follows: S0 = no high pressure warning, S1 = 1 warning, and S2 = 2 warnings, the handle does not effect state transition, only whether or not the machine is pumping. The problem rested in the Set/Reset as Tim mentioned below. \$\endgroup\$
    – rphello101
    Apr 9, 2013 at 17:25

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ I think I understand what you mean. Any suggestions on where best to put a reset? \$\endgroup\$
    – rphello101
    Apr 8, 2013 at 23:12
  • 2
    \$\begingroup\$ Ideally you could replace your DFF with resettable DFFs which have a dedicated reset pin, but if that's not supported to your tool you can add an extra logic gate at the D pin of the flop. If I assume that you want to reset the flops to 0, and have an active low reset reset_, then I would just add an AND gate to the D-pin of each flop (D = original input && reset_). Then just pull reset low for a clock cycle and the flops will fall to zero. @rphello101 \$\endgroup\$
    – Tim
    Apr 8, 2013 at 23:20
  • \$\begingroup\$ This did turn out to be my problem. My second problem that I had was in my wiring. My SOP's were correct, but if you look at my wiring, there are a couple wrong connections. Thanks for the advice. \$\endgroup\$
    – rphello101
    Apr 9, 2013 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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