# Simple state machine's state table

EDIT: This is a homework question. What I need to know is how to solve the circuit through the transition table. That is, how do I write the circuits for the state changes (is it a flip-flop circuit, or a combinatorial circuit?) and the outputs?

I have a simple state machine with 3 states to control the automatic doors of a mall: waiting, entering and leaving. Two sensors, one in each side of the door, a timer that counts to 10 seconds.

The door opens when one of the sensors is activated, and remains open until the other sensor is activated or 10 seconds pass without any other input. Every time a person goes in or out, an alarm goes off. One of the suppositions is that only one person goes in or out at any time, so the sensors can't go off at the same time.

I have then 3 inputs to the circuit: S1, S2 and the Timer. And one output, the alarm A.

I was wondering how I'm supposed to write the state transitions table. I'd written something like

S1 S2 10s Q(n) Q(n+1) Alarm

0 0 0 A A 0

...

1 1 1 A X X

0 0 0 B B 0

...

1 1 1 B X X

And so on, with the 0-7 table being repeated for the states Q(n) = A, B and C.

Is this correct?

What's the next step to build the combinatorial circuit? I know I have to make the Karnaugh maps, but how do I factor in the states A, B, C? Are they supposed to be flip-flops? Are those then different "functions" I have to make the Karnaugh maps for?

• Does your timer tick every 1 second or every 10 seconds? – Chris Laplante Nov 2 '13 at 21:38
• No, every 1 second. Sends a signal when it reaches 10 seconds. – Heathcliff Nov 2 '13 at 21:46
• Sorry, I worded my question poorly. I meant when is Timer asserted high - now I understand it's every 10 seconds. The reason I ask is because if Timer was asserted every second, you'd need extra states (for 1s, 2s, etc.) – Chris Laplante Nov 2 '13 at 21:54
• There's a lot of missing information here : for one thing, your states are waiting, entering, leaving. So what are A,B,C? For another, you will need to know the requirement for sounding an alarm : "when a person goes in or out " ... when they start to do so, or when they have completed, so you can shut the store door (or wake Security) after the thief has bolted? If I trigger the outside sensor, change my mind and trigger it again, do you sound the alarm or not? If I get halfway in, stand very still, does the door close on me in 10 seconds? You may need a fuller specification. – user_1818839 Nov 2 '13 at 22:02
• I must be missing something, better states for me seem to be Open, Closing, Closed and Opening. Entering and Leaving are actions that trigger state changes. Ignore me. ;) – kenny Nov 3 '13 at 3:49

• @Andyaka, The homework tag was deprecated. We're asked to tag questions according to their content, not according to meta-issues. There was a post about this on Meta and on Meta.SO. OP should not be required to re-state this in his question. – The Photon Nov 3 '13 at 15:24