ABC of Electronics cosycom.com
LESSON 36

Flip-Flops & Latches

The basic memory element of digital electronics — a circuit that can hold a single bit of state, even after its inputs change.

Every logic gate you met in Lesson 21 is combinational — its output depends only on its current inputs, with no memory of what happened before. But computers, counters, and registers all need to remember something — a stored bit that persists even after the input that set it goes away. That's the job of a flip-flop: the basic 1-bit memory element of digital electronics.

The simplest version, a D flip-flop ("D" for data), has a data input, a clock input, and two outputs labeled Q and Q̄ (Q and "not-Q," always opposite of each other). Its behavior is simple but powerful: on the precise moment the clock input transitions from LOW to HIGH (called the clock edge), the flip-flop copies whatever value is currently on its data input onto its Q output — and then holds that value steady, ignoring any further changes on the data input, until the next clock edge arrives.

That "only update on the clock edge, hold steady otherwise" behavior is exactly what gives digital circuits reliable memory: a chain of flip-flops, all sharing the same clock signal, is what makes up a microcontroller's internal registers, and chaining flip-flops together in specific patterns builds counters — circuits that count clock pulses, used for everything from clock dividers to timers.

A close relative, the latch, works similarly but updates continuously whenever an "enable" input is active, rather than only on a clock edge — useful in some circuits, but less predictable in timing than a proper clocked flip-flop.

D CLK
D flip-flop block Data goes in one side; on every clock edge, that value is captured and held on the Q output until the next edge.
KEY TAKEAWAY
A flip-flop is digital electronics' basic memory element — it captures its data input on a clock edge and holds that value steady until the next edge, giving circuits the ability to remember.