

Recall that a NAND gate is only off if both inputs are on.īy turning the bottom NAND gate on, it turns off the top NAND gate, which guarantees the bottom NAND gate remains off even as the second button is turned on again. Notice it works more or less the same way as the NAND gate, except that to turn on one side or another, you must turn off the input:īy opening the bottom switch, the NAND gate on the bottom turns on. We wire up the switch as we did with the NOR gate: You can also build an SR latch using NAND gates. So we call this state ‘undefined’ because the behavior after we release the two input switches at the same time is unknowable. Because you can never turn them off at the exact same time, and even if you could, the transistors, resistors and capacitances of the circuits are not exactly identical on both of the NOR gates, inevitably the SR gate will fall into one of two possible states. The problem comes when you turn off both switches. This turns off both the outputs Q and ~Q: Both NOR gates have at least one input set to 1, which means both outputs will be set to zero. To see what I mean by this, consider if we close both switches in our SR gate (based on NOR gates) above. Now “undefined” in the table above doesn’t mean that the behavior is unknowable, but that it’s not really an “allowed” state if we want predictable behavior. The logic table for our SR gate is a little different than for our basic logic gates: S The idea is that one input “sets” the latch on, the other “resets” the latch off, and customarily it’s represented as a box with two inputs: “S” and “R”, and two outputs, “Q” and “~Q” (or “not Q”): (It may also be called an “SR gate” or an “SR flip-flop”.)

This gate is called the “Set-Reset Latch”, or “SR Latch” for short. (Note, for clarity, the LED that gets turned on was placed on the same side as the switch that turns that LED on.) If we wire these transistors up, we get the following circuit. The four transistors in the center represent our bistable circuit. This gives us the following circuit diagram:

We can construct each of these NOR gates using individual transistors, as we saw in the previous section. Since they’re both on, the bottom gate remains off (and the top gate on) if we release the bottom button: This then causes the top gate to turn on (as both its inputs are off), which means both inputs of the bottom gate are now on. Pressing the button causes the bottom gate to turn off. If we were to press the bottom button, on the other hand, causing the bottom NOR gate to set its output to 0: In the image above, as both inputs to the bottom NOR gate is 0, the output is 1–and that output keeps the top NOR gate’s output off. Recall with a NOR gate, the output is 1 if both inputs are 0. The problem with that circuit, however, is to set the state of that circuit you have to pull one of the inputs of one of the transistors to the voltage line to change the state of the circut.įor a digital circuit, we want to also drive the input from the output of another digital circuit, and that requires a slightly different approach. In the discussion of a bistable circuit, we showed how a bistable circuit–that is, a circuit that is stable in one of two states–can be made with just two NPN transistors.
