# The S-R Latch (Quickstart Tutorial)

The S-R latch is a key circuit in digital storage units. In this tutorial, you will learn how it works, its truth table, and how to build one with different logic gates.

## What is an S-R Latch?

Before starting with the S-R latch you need to know what a latch is. A latch is an asynchronous circuit (it doesn’t require a clock signal to work), and it has two stable states, HIGH (“1”) and LOW (“0”), that can be used for storing binary data. Many sequential circuits and larger storage devices, such as shift registers, use latches as their principal building block.

The simplest latch is the Set-Reset (S-R) latch. You can build one by connecting two NOR gates with a cross-feedback loop.

This feedback path is crucial to storing one bit of data as long as the circuit is powered. In this circuit, the upper gate has the S input and the main output Q, while the lower gate has the R input and the inverted output Q̅.

## How does the S-R Latch work?

First of all, let’s define the truth table of the S-R latch:

Now, let’s analyze how the S-R latch works using its truth table and its circuit with NOR gates. Remember that the NOR gate only gives “1” when both inputs are “0”, with any other input combination the output is “0”.

You can see in the truth table that when both inputs S and R are equal to “0”, the output Q remains the same as it was. This is the memory function of the S-R latch because it saves the previous value. Suppose the Q output is “1” in the present state. If you now place both inputs in “0”, then the output will remain “1” as follows:

Then, how would you “Reset” the Q output to “0”? Well, as you can see in the truth table, you need a “1” in the R input and a “0” in the S input.

But, if you want to “Set” a “1” in the Q output just follow the truth table and place a “1” in the S input and a “0” in the R input.

Finally, the S and R inputs should never be “1” at the same time because the NOR gate only gives “1” when both of its inputs are “0”, but if one input is “1”, then the output will be “0”. As a result, if S and R are “1”, both latches’ outputs will be “0” at the same time, something that violates this latch’s working principle.

## SR-LATCH WITH NAND GATES

The S-R Latch can also be built using two NAND gates:

In the above circuit, you might have noticed slight differences from the one with NOR gates. Now the inputs have been swapped, with the S input in the upper gate and the R input in the lower gate. In addition, the inputs have been negated.

It works the same way as with NOR gates, just that the inputs are inverted. Here’s the truth table:

## Example Circuit

As a practical example, you can build an SR latch using the CD4001 chip. Below you can see how the CD4001 has four NOR gates inside, making it ideal for this kind of application.

The circuit works as follows: when the button PB2 is pushed, the LED L2 turns on and stays on even after PB2 is released, while the LED L1 remains off. LED L2 turns off when the button PB1 is pressed, whereas LED L1 turns and stays on even after PB1 has been released. To assemble the above circuit you need:

• The CD4001 chip
• Two push buttons (PB1 and PB2)
• Two LEDs
• Two 10 kΩ resistors (R1 and R2)
• Two 330 Ω resistors (R3 and R4)

## Questions?

Do you have any questions about S-R Latch? Let me know in the comments below.

## More Digital Electronics Tutorials

### 5 thoughts on “The S-R Latch (Quickstart Tutorial)”

1. In the provided example circuit, what happens when you press both buttons, thus triggering the invalid state? Is there risk of damaging the circuit?

• You don’t damage anything, no. In the circuit example above, both outputs will be 0 if you push both buttons.