I have an assignment in college and I would like to ask some questions:

You are to design a Mealy state diagram for a safety device. Assume that two debounced push-buttons, A and B, are available to enter the combination. An electromechanical interlock guarantees that the buttons cannot be activated simultaneously. The lock should have the following features:

The combination is A-A-B-A-B-A. If this sequence is correctly entered, an output signal is asserted that causes the lock to open.

For any state, three B pulses in a row should guarantee to reset the control to its initial state.

When any out-of-sequence use of the A push-button occurs, an output is asserted that rings a bell to warn that the lock is being tampered with.

Once the lock is open, pressing either A or B will cause the lock to close without signaling an error. Draw a Mealy state diagram for this finite state machine. Indicate what each state represents and what input conditions cause state and output changes. Not everything may have been specified, so write down any assumptions you make.

I have to implement this Mealy machine using D flip-flops and MUX'es.

I have 10 states for my machine:

S0 -> "Input Start" // Nothing happened
S1 -> A
S2 -> AA
S3 -> AAB
S4 -> AABA
S6 -> AABABA -> this means EXIT
S7 -> B
S8 -> BB
S9 -> A -> "ALARM ON"

*****EDIT to add machine pic enter image description here

My questions are:

  • From what should I start in creating the truth table (on this specific assignment -- How can I think the necesarry flip-flops and MUX'es)?
  • How can I create this specific diagram? Using only MUX'es and D-Flipflops?

1 Answer 1


Without answering your assignment, I'd probably start by drawing a state machine. This forces you to walk through the logic in a really visual way, until you really understand the question.

Once you have the state machine, you can write the truth table, and scan the truth table to find redundant states and get rid of them-- then maybe redraw the truth table.

There are a number of good sources on doing this -- https://www.youtube.com/watch?v=i0FK4fNTH9c for example.

Form there, you MIGHT be able to see your implementation, or you might not.

If not, the formulaic way to flip flop implementation is to make a Karnaugh Map, reduce it to logic, and then implement the logic w/ flip flops. I suggest poking around at http://www2.elo.utfsm.cl/~lsb/elo211/aplicaciones/katz/chapter6/chapter06.doc3.html

If your state machine is big, this can be quite a tedious exercise

  • \$\begingroup\$ One more question, are the 10 states i created good for this machine? \$\endgroup\$ Commented Dec 2, 2014 at 16:09
  • \$\begingroup\$ @TudorutRobert I'd need to see the states that the machine gets sent to on failures to know -- and it requires careful thought. For example, if you get AAA instead of AAB, you can still wait in the same state until a B comes along, and not go all the way back to the beginning. A real state machine like at upload.wikimedia.org/wikipedia/commons/thumb/2/2a/… would make this much easier to understand. \$\endgroup\$ Commented Dec 2, 2014 at 16:24
  • \$\begingroup\$ My machines triggers an alarm each time the introduced sequence does not match the one i am trying to obtain.Also,if the sequence gets an BBB it goes back to the begging(In S0), as i described the states above. + EDIT: I will post a picture of the machine's states. \$\endgroup\$ Commented Dec 2, 2014 at 16:38
  • \$\begingroup\$ @TudorutRobert, that isn't exactly what you were asked for. You were asked to beep on improper A's \$\endgroup\$ Commented Dec 2, 2014 at 16:49
  • \$\begingroup\$ The picture of the states that i am using is here: link .Scott Seidman,i am trying to understand the way in which i can do this homework,this is why i am soo an annoying with these questions. I would really like to understand how to do this homework as i am working on it for a long time now and didn't even manage to advance to the "Truth Table"(in which i might need some help at one point). \$\endgroup\$ Commented Dec 2, 2014 at 17:04

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.