Electronic – How to eliminate the forbidden state in an SR latch

debouncelatchswitches

I'd like a latch where the output only changes when both inputs have changed. If only one input has changed, the latch output should stay constant.

Here's the state table I want:

S R | Qnext
----+------
0 0 |   Q
0 1 |   0
1 0 |   1
1 1 |   Q

The above looks just like a standard SR latch, except that the (1, 1) forbidden state is replaced with a hold state.

How can I design the above latch? I could add some logic to convert the (1, 1) inputs to (0, 0) (e.g., S' = S(~R), R' = R(~S)), but I'm worried about glitches.

Background/motivation:

I have a double pole single throw (DPST) switch (one normally open, one normally closed). I assumed that when the switch is toggled, the pole that is closing would bounce while the pole that is opening would not. If this assumption had been correct, I would have been able to debounce the switch with the above latch.

If my assumption had been correct, then the main challenge would have been the fact that the two poles are racy: pole #1 might change before or after pole #2 changes. This would mean that during a transition the poles could be in any state: (0,0), (0,1), (1,0), or (1,1). But, there would be a property I could rely on: Once the switch went from (0,1) to (1,0) (or vice-versa), it wouldn't bounce back. This property would have allowed the above latch to debounce the switch.

Best Answer

First of all, your assumption that mechanical switches open cleanly is false. They bounce on both make and break.

However, to address the specific question of the latch, it's simply a matter of creating an S-R latch that only switches on the "final" states (0,1) and (1,0). The latch will change state the first time the new final state is reached. If the make occurs first then the bouncing between the initial state and (1,1) will cause no change to the latch. Once the other contact breaks then the latch will switch, and any bouncing back to (0,0) will be ignored. If the break occurs first, then the latch will switch on the first make of the other contact, and again, any bouncing back to (0,0) will be ignored.

diagram of special S-R latch