Feedback Magic — The SR Latch
All the circuits we've built so far are combinational: the output depends only on the current inputs. Change the input — the output changes. But a computer needs to remember things. It needs memory cells that hold state even when inputs change.
The SR latch (Set-Reset latch) is the first step into the world of sequential logic. It consists of two cross-coupled NOR gates. The output of each NOR feeds into one input of the other NOR. This feedback loop is the magic: when you pulse the S (Set) input, the latch "remembers" a 1 at its output. When you pulse R (Reset), it remembers a 0. When both S and R are 0, the latch simply holds its last state — it is a 1-bit memory!
This is a profound shift in thinking. Until now, circuits were like mathematical functions: input → output. The SR latch introduces time into the equation. Its output depends not just on the current inputs, but on the history of what happened before. This is the essence of all computer memory.
Practical example. Press a button to turn on a lamp. The button is the S input — a brief pulse sets the latch. The lamp stays on even after you release the button. Press another button — the R input — and the lamp turns off. No button is held down; the circuit itself remembers whether the lamp should be on or off. This is exactly how the power button on your computer works: one press turns it on, the circuit remembers, and another press (or holding it) sends a reset signal.