Home
LogicRoo / Sequential Circuits / SR Latch Circuit
SEQUENTIAL · LATCH

SR Latch Circuit

A simple SR latch walkthrough — NOR and NAND versions, truth table, the forbidden state, wiring steps, and an interactive latch you can explore in the browser.

Sequential logic · 2 NOR gates

Two gates that
listen to each other.

An SR latch is the simplest circuit that remembers a bit. Two NOR gates feed their outputs into each other, so a short pulse on S sets Q, a short pulse on R resets it, and when both inputs are low the latch simply holds. There is no clock: it reacts the moment an input changes.

2Inputs S, R
2Cross-coupled NOR gates
1Bit of memory
74HC02Gate IC
Pulse S or R and watch Q hold, or flip the view to see the timing diagram →
SCH-05 · 74HC02_SRLATCH
mode hold
⇄ Show timing diagram
Q
Q̄
S0 R0 Q0 Q̄1
Changes0 Q0
S0
R0
S · pulse set
R · pulse reset
Power cycle

Hold S or R to pulse them · click the S / R toggles to latch a level (set both, then release both, to see the race) · Power cycle shows the random start state


Parts bin

What you need

Two gates make the memory. The rest is a pair of buttons to drive S and R, and two LEDs to see the result.

×1 74HC02 — quad 2-input NOR gate IC (two gates used) IC1
×2 Pushbutton — SET and RESET SW-S, SW-R
×2 10 kΩ Resistor — S and R pull-down R3–R4
×2 LED — Q and Q̄ indicators LED1–2
×2 330 Ω Resistor — LED current limit R1–R2
×1 100 nF Capacitor — supply decoupling C1
×1 Breadboard BASE
×— Jumper Wires BASE
×1 5V Supply (2–6V accepted) PWR

Reference

74HC02 pin overview (gates 1 and 2)

The chip has four identical NOR gates. These are the pins of the two that form the latch.

PinNumberTypeWhat it does
VCC 14 Power Supply voltage, +2V to +6V
GND 7 Power Ground, 0V
1Y 1 Output Gate 1 output: this is Q
1A 2 Input Gate 1 input: the R (reset) button
1B 3 Input Gate 1 input: fed back from Q̄ (pin 4)
2Y 4 Output Gate 2 output: this is Q̄
2A 5 Input Gate 2 input: the S (set) button
2B 6 Input Gate 2 input: fed back from Q (pin 1)

Behaviour

Truth table

Values apply as soon as the inputs change, since there is no clock. The characteristic equation is Q(next) = S + R̄·Q, valid only while S·R = 0.

S RQ(next)Q̄(next)Action
0 0 Q Q̄ Hold
0 1 0 1 Reset
1 0 1 0 Set
1 1 0 0 Invalid

Operating principle

How two gates remember

Flip to the timing view above, pulse S, then let go. Q stays HIGH with nothing driving it but the loop itself.

01

Both inputs rest LOW, and the loop keeps the current state.

02

A HIGH on S forces Q̄ to 0, which lets Q rise to 1.

03

Q = 1 now holds Q̄ at 0, even after S returns LOW.

04

A HIGH on R does the mirror image and flips the loop back.

A NOR gate outputs 1 only when both inputs are 0. Cross-couple two of them and each output becomes an input of the other. A 1 on one output forces the other to 0, and that 0 is exactly what keeps the first at 1. The loop is self-reinforcing, so it has two stable states and stays in whichever it was last pushed into.

The one forbidden input is S=R=1. Both outputs are pulled to 0, so Q and Q̄ stop being opposites. Worse, if S and R then fall at the same instant, both gates try to rise together and the winner is decided by microscopic differences in the silicon. That is why the JK flip-flop gives that combination a useful meaning instead.

Because it has no clock, an SR latch is level-sensitive: it reacts the moment S or R changes. That makes it ideal for jobs such as switch debouncing, where a single clean transition is needed from a bouncing contact, and it is the first building block of every clocked flip-flop.

NOR latch vs NAND latch

NOR latch (this build): inputs are active HIGH. Idle state is S=R=0, and the forbidden state is S=R=1.

NAND latch: built from a 74HC00, inputs are active LOW. Idle state is S̄=R̄=1, and the forbidden state is S̄=R̄=0.

Both hold a bit in exactly the same way. Only the polarity of the inputs is swapped.


Assembly

Building it on a breadboard

Six steps. Once it works, swap the two buttons for a single-pole double-throw switch and you have a bounce-free switch.

Seat the 74HC02

Straddle the chip across the centre gap, notch to the left, so pins 1–7 and 8–14 land in separate rows. Note that on this chip the output of each gate is the first pin of its group, not the last.

Power it and park the unused gates

VCC (14) to the positive rail, GND (7) to the negative rail, with the 100 nF capacitor right beside the chip. Only gates 1 and 2 are used: tie the inputs of gates 3 and 4 (pins 8, 9, 11 and 12) to GND and leave their outputs (10 and 13) open. Floating CMOS inputs pick up noise and waste power.

Cross-couple the two gates

This is the whole trick. Jumper the output of gate 2 (pin 4, Q̄) to an input of gate 1 (pin 3), and the output of gate 1 (pin 1, Q) to an input of gate 2 (pin 6). Each gate now listens to the other one.

Wire the SET and RESET buttons

The SET button goes from +V to pin 5 (S), and the RESET button from +V to pin 2 (R). Add a 10 kΩ resistor from each of those pins to GND so they read a clean LOW until pressed.

Add the output LEDs

Q (pin 1) and Q̄ (pin 4) each drive an LED through its own 330 Ω resistor to GND. Once the latch has settled, exactly one LED is lit.

Power up and test it

Press and release SET: Q lights and stays lit after you let go. Press and release RESET: Q goes dark and Q̄ lights. Pressing the same button again changes nothing, because the latch already holds that state.


If it misbehaves

Dead, random, or both LEDs dark

Almost always missing feedback wires, a floating S or R input, or pressing both buttons at once.

  • Neither LED responds to the buttons — the feedback jumpers are missing or crossed; pin 4 must go to pin 3 and pin 1 to pin 6.
  • Both LEDs are off while a button is held — both S and R are HIGH at once, which is the invalid state for a NOR latch; release one of them.
  • Pressing both buttons and releasing gives a random result — that is correct. When S and R fall together, the two gates race and the winner is decided by tiny differences in the chip.
  • The latch flips by itself or glitches when you touch it — S or R is floating; check the 10 kΩ pull-downs on pins 2 and 5.
  • One press seems to set and then reset it — the pushbutton is bouncing and sending a burst of pulses; a bounce on a single line is harmless for a latch, but two buttons bouncing against each other are not.
  • The state after power-up is random — that is normal. A latch has no defined start state, so press RESET once to start from a known 0.