⚑ ELT 102 · Digital Logic & Solid State Devices Lesson 6 of 8
Unit 3 Β· Digital Foundations

Latches & Flip-Flops

Bistable storage elements that remember one bit: level-sensitive latches whose outputs follow inputs while enabled, and edge-triggered flip-flops that capture data at a precise clock instant β€” the foundation of every register, counter, and state machine.

⏱ 3 Hours Study πŸ“‹ 9 Core Topics πŸ“ Symbol Library (8 devices) πŸ“ˆ Sequential Logic Lab + Timing Diagram πŸš— Two Paired Analogies 🏭 8 Real-World Applications

Learning Objectives

By the end of this lesson, you will be able to:

  • Explain bistability β€” how a circuit with two stable states stores one bit β€” and why sequential logic needs it.
  • Distinguish level-sensitive latches from edge-triggered flip-flops, and predict when each device's output is allowed to change.
  • Describe SR latch operation (Set, Reset, Hold), identify the invalid S=R=1 condition, and explain the resulting race/metastability hazard.
  • Analyze gated SR and D latches, including transparent operation while enable is active and hold behavior when it is not.
  • Interpret characteristic tables and timing diagrams for SR, D, JK, and T flip-flops, including clock-enable variants.
  • Explain why the JK flip-flop resolves the SR invalid state as toggle, and why it is called the universal flip-flop.
  • Apply the T flip-flop's toggle mode to divide-by-2 frequency division and binary counting.
  • Identify the IEEE/ANSI block symbols for all eight devices, including the clock-edge triangle and inversion bubble conventions.
  • Relate level-sensitive and edge-triggered behavior to two paired everyday analogies, and explain where each analogy stops being accurate.
  • Match each device to its common applications β€” flags, registers, shift registers, counters, synchronizers, and state machines β€” and verify every behavior in the Sequential Logic Lab.

Key Terms & Concepts

Click any card to reveal its definition.

Bistable Fundamentals
Bistable Element
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
A circuit with exactly two stable states β€” it rests happily at Q=0 or Q=1 and stays there until commanded to change. Two states = one bit of memory. Every latch and flip-flop is a bistable at heart.
Sequential Logic
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
Logic whose output depends on inputs and on stored history. Lesson 5's gates were combinational (output = f(inputs), no memory); adding bistables gives circuits a past β€” and makes counters, registers, and computers possible.
Q and Q̅ Outputs
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
The complementary output pair every storage element provides: Q is the stored bit, Q̅ is always its inverse. If both ever agree, something is wrong β€” see the invalid SR condition.
Feedback (Cross-Coupling)
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
The construction trick behind memory: two gates (NOR or NAND) with each output wired to the other's input. Each gate holds its partner in place β€” the loop "remembers" with no moving parts and no capacitor.
Level-Sensitive
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
Responding to a control signal's level: a latch obeys its inputs the entire time enable is HIGH. Output can change continuously during that window β€” flexible, but harder to time precisely.
Edge-Triggered
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
Responding only to a clock transition (rising or falling edge). A flip-flop samples its inputs at that one instant and holds the result until the next edge β€” the discipline that makes large synchronous systems possible.
Metastability
Bistable Fundamentals
πŸ”„ Click to reveal definition
Definition
The unstable in-between: a bistable balanced momentarily between its two states (like a coin on edge), outputting an invalid level until it randomly falls one way. Provoked by the SR invalid state or by violating setup/hold timing.
Latches
SR Latch
Latches
πŸ”„ Click to reveal definition
Definition
The simplest bistable: Set forces Q=1, Reset forces Q=0, both inactive holds the previous state. Built from two cross-coupled NOR (or NAND) gates. Its flaw: S=R=1 simultaneously is invalid.
Invalid (Forbidden) State
Latches
πŸ”„ Click to reveal definition
Definition
Asserting Set and Reset together: both outputs are forced to the same level (Q = Q̅ β€” a contradiction), and releasing both inputs at once triggers a race whose winner is unpredictable. Designs must prevent this input combination.
Gated (Enabled) SR Latch
Latches
πŸ”„ Click to reveal definition
Definition
An SR latch behind two AND gates controlled by an enable line: when EN=1 the latch listens to S and R; when EN=0 it ignores them and holds. The first step from "always listening" toward controlled, timed storage.
D (Transparent) Latch
Latches
πŸ”„ Click to reveal definition
Definition
The SR fix: one Data input drives S directly and R through an inverter, making S=R=1 impossible. While EN=1, Q follows D "transparently"; when EN drops, Q freezes at the last value. One input, no forbidden state.
Transparent Operation
Latches
πŸ”„ Click to reveal definition
Definition
The defining latch behavior: while enable is active, the output is a live window onto the input β€” wiggle D and Q wiggles with it. Watch it happen in the Lab, then drop EN and watch the window freeze.
Enable (EN) Input
Latches
πŸ”„ Click to reveal definition
Definition
The level-sensitive control that opens or closes a latch: EN=1 β†’ latch responds; EN=0 β†’ latch holds. Used for write control on registers, gating data into subsystems, and bus interfacing.
Flip-Flops
Clock (CLK)
Flip-Flops
πŸ”„ Click to reveal definition
Definition
The system heartbeat: a square wave whose edges tell every flip-flop now. On the schematic symbol, the small triangle (β–·) on the clock pin marks edge triggering; a bubble before it means falling-edge.
SR Flip-Flop
Flip-Flops
πŸ”„ Click to reveal definition
Definition
The SR latch's edge-triggered counterpart: on the active clock edge, S=1 sets, R=1 resets, both 0 holds. Inherits the same invalid S=R=1 case β€” the flaw the JK was invented to fix.
D Flip-Flop
Flip-Flops
πŸ”„ Click to reveal definition
Definition
The workhorse one-bit memory: at the active edge, Q takes whatever D holds at that instant, then ignores D completely until the next edge. Characteristic equation: Qnext = D. The cell inside registers, pipelines, and counters.
Clock Enable (CE)
Flip-Flops
πŸ”„ Click to reveal definition
Definition
A conditional-load input on a flip-flop: EN=1 β†’ load new data on the edge; EN=0 β†’ keep the old value even though the clock keeps ticking. Storage becomes conditional without touching the clock wiring β€” the clean way to gate updates.
JK Flip-Flop
Flip-Flops
πŸ”„ Click to reveal definition
Definition
The SR improved: J=1,K=0 sets; J=0,K=1 resets; both 0 holds; and both 1 β€” the formerly forbidden case β€” toggles. Called the universal flip-flop because it can emulate D (K=J̅) and T (J=K) behavior.
T (Toggle) Flip-Flop
Flip-Flops
πŸ”„ Click to reveal definition
Definition
One input: T=1 β†’ Q inverts on every active edge; T=0 β†’ Q holds. Toggling halves the clock frequency at Q, making the T flip-flop the natural divide-by-2 stage and the building block of ripple counters.
Timing & Operations
Set Β· Reset Β· Hold Β· Toggle
Timing & Operations
πŸ”„ Click to reveal definition
Definition
The four verbs of sequential logic. Set: force Q=1. Reset (Clear): force Q=0. Hold: keep the stored value. Toggle: invert the stored value on the next active clock event.
Timing Diagram
Timing & Operations
πŸ”„ Click to reveal definition
Definition
Waveforms stacked against a shared time axis β€” the native language of sequential logic. Reading one means tracking each input lane and asking, at every enable window or clock edge, "what does Q do now?" The Lab draws yours live.
Setup & Hold Time
Timing & Operations
πŸ”„ Click to reveal definition
Definition
The small windows around a clock edge when a flip-flop's data input must be stable β€” settled before the edge (setup) and unchanged briefly after it (hold). Violating them invites metastability.
Characteristic Table
Timing & Operations
πŸ”„ Click to reveal definition
Definition
A truth table for memory: inputs plus the present state Q determine the next state Qnext. The extra "present state" column is exactly what separates sequential devices from Lesson 5's combinational gates.
Frequency Division
Timing & Operations
πŸ”„ Click to reveal definition
Definition
A toggling flip-flop's Q completes one full cycle for every two clock cycles β€” output frequency = clock Γ· 2. Chain n toggle stages for Γ·2ⁿ: the principle inside counters, clock prescalers, and digital watches.
Register
Timing & Operations
πŸ”„ Click to reveal definition
Definition
A row of D flip-flops sharing one clock β€” n flip-flops store an n-bit word in a single edge. Wire each Q to the next D and it becomes a shift register, marching bits sideways one position per clock.

πŸ“ Latch & Flip-Flop Symbol Library

Eight devices, one reading system. Latch symbols show only data and enable pins; flip-flop symbols add a clock pin marked with the edge triangle (β–·) β€” the single visual cue that says "this device listens only at the clock transition." A bubble before the triangle would mean falling-edge triggering. Each card carries the device's characteristic table; red rows are forbidden.

R S Q Q̅
The Bistable Core
Two cross-coupled NOR gates β€” each output holds the other's input. This feedback loop is the memory.
SR QQ̅
SR Latch
Set/Reset flag storage Β· remembers that a condition occurred
SRQ
00hold
101
010
11invalid
SENR QQ̅
Gated SR Latch
EN=1: responds to S/R Β· EN=0: ignores inputs, holds
ENSRQ
0xxhold
1101
1010
111invalid
DEN QQ̅
D (Transparent) Latch
EN=1: Q follows D live Β· EN=0: Q freezes Β· no invalid state
ENDQ
0xhold
100
111
SCLKR QQ̅
SR Flip-Flop
SR behavior, but only at the clock edge β–· Β· same invalid case
SRQ next
00hold
101
010
11invalid
DCLK QQ̅
D Flip-Flop
Q captures D at the edge, then ignores D Β· Qnext = D
DQ next
00
11
DENCLK QQ̅
D Flip-Flop + Enable
Loads at the edge only if EN=1 Β· conditional storage, same clock
ENDQ next
0xhold
100
111
JCLKK QQ̅
JK Flip-Flop Β· universal
The SR fix: J=K=1 toggles instead of being forbidden
JKQ next
00hold
101
010
11toggle
TCLK QQ̅
T (Toggle) Flip-Flop
T=1: Q inverts every edge Β· the divide-by-2 stage
TQ next
0hold
1toggle

Core Lesson Content

The Core Idea: A Circuit With Two Stable States

Every circuit in Lesson 5 was combinational β€” its output was a pure function of its present inputs, with no memory of the past. Remove the inputs and the answer vanishes. Digital systems need more than that: a counter must remember its count, a register must hold its word, a state machine must know where it is. They need memory, and the smallest unit of memory is the bistable element:

  • A bistable has exactly two stable states and can rest indefinitely in either β€” Q=0 or Q=1. Two states store exactly one bit.
  • It's built from pure feedback: two cross-coupled gates (see the first symbol card above), each output holding the other's input in place. No capacitor, no moving parts β€” the loop simply keeps agreeing with itself.
  • Every device in this lesson β€” every latch and every flip-flop β€” is this same bistable core wearing different control logic that decides when it's allowed to change.

The One Distinction That Organizes Everything

LatchFlip-Flop
SensitivityLevel-sensitiveEdge-triggered
Output changesContinuously, the whole time enable is activeAt one instant β€” the clock edge β€” then holds until the next edge

Keep that pair of sentences in mind through all nine tabs: a latch's output can follow its inputs during an interval; a flip-flop's output updates at an instant and stays fixed. Everything else is detail.

πŸ’‘ Why This Is the Big Leap
With memory, output depends on inputs and history β€” the definition of sequential logic. This is the tab where digital electronics stops being a calculator and starts being a machine that can count, store, sequence, and eventually compute. Cross-coupled bistables scaled up are literally the SRAM cache inside every processor.

The SR Latch

The simplest usable bistable adds two control inputs to the cross-coupled core: Set and Reset, with complementary outputs Q and Q̅.

Operation

  • Set (S=1, R=0): forces Q = 1. The latch now "remembers" being set even after S returns to 0.
  • Reset (R=1, S=0): forces Q = 0.
  • Hold (S=0, R=0): neither input asserted β€” the feedback loop preserves whatever state was last written. This is the memory in action.
S=1 β†’ Q=1 (set)  |  R=1 β†’ Q=0 (reset)  |  S=R=0 β†’ Q holds  |  S=R=1 β†’ INVALID
⚠️ The Invalid State: S = R = 1
Assert Set and Reset together and both outputs are forced to the same level β€” Q = Q̅, a logical contradiction. Worse: when both inputs release at once, the two gates race, and which one wins is decided by nanosecond-scale manufacturing differences. The result is unpredictable and can even hang momentarily between states (metastability β€” a coin landing on its edge). Every SR-based design must guarantee this input combination never occurs; the D latch (Tab 4) and JK flip-flop (Tab 7) are two different engineering answers to this exact flaw.

Applications

Simple control flags and basic state storage β€” any circuit that must remember whether a condition has occurred: an over-temperature event latched until an operator clears it, an alarm that stays on after a momentary trigger, or the classic switch debouncer that turns a bouncing mechanical contact into one clean transition.

The Gated SR Latch

A bare SR latch listens to its inputs all the time β€” any glitch on S or R instantly corrupts the stored bit. The gated (enabled) SR latch fixes that by putting the latch behind a gate: an enable input that opens or closes the door.

Operation

  • EN = 1 (door open): the latch responds normally to Set and Reset.
  • EN = 0 (door closed): S and R are completely ignored; the latch holds its state no matter what the inputs do.

Construction is two AND gates in front of the SR core: S and R each get ANDed with EN, so with EN=0 the core sees 0,0 β€” the hold condition β€” regardless of the actual inputs. Note the invalid state survives: EN=1 with S=R=1 is still forbidden.

Why Gating Matters

This is the first appearance of an idea that dominates the rest of the lesson: controlled updating rather than continuous response. You choose when the storage element is writable. In timing-sensitive control logic, the enable window is opened only when the inputs are known to be valid and quiet.

Applications

Gated storage in timing-sensitive control logic and simple memory gating β€” e.g., latching a sensor reading only during the interval it's guaranteed stable, or write-protecting a stored flag while other circuitry is switching.

🎯 Bench Perspective
In the Lab, set S=1 with EN=0 β€” nothing happens. Raise EN and Q snaps high instantly. That "nothing… now" behavior is the entire concept of gating, and you'll feel it more clearly in ten seconds of clicking than in ten minutes of reading.

The D Latch β€” and Its Enable

The gated SR latch still carries the forbidden S=R=1 landmine. The D latch removes it with one elegant move: replace the two inputs with a single Data input, wired to S directly and to R through an inverter. Now S and R are always opposites β€” the invalid combination is structurally impossible.

Operation

EN = 1 β†’ Q follows D continuously ("transparent")   |   EN = 0 β†’ Q holds the last value
  • While enabled, the output is a live window onto the input β€” wiggle D and Q wiggles in sympathy. This is why it's called the transparent latch.
  • The instant EN falls, Q freezes at whatever D held at that moment. The falling edge of enable is effectively the "capture" event.

The D Latch with Explicit Enable

The same concept packaged with explicit level-sensitive write control: if EN = 1, Q tracks D; if EN = 0, Q retains its prior state. This is the form you'll meet as register-like storage, for gating data into subsystems, and on bus interfaces β€” a latch grabs the data lines during the brief window an address is valid, then holds them for the slower peripheral while the bus moves on.

Applications

Temporary data storage, buffering, and input/output interfacing β€” anywhere you need to catch a value during a known-valid window and hold it afterward.

⚠️ Transparency Cuts Both Ways
While EN is high, glitches on D pass straight through to Q β€” transparency means everything gets through, noise included. That's precisely the weakness that motivates the flip-flop: shrink the vulnerable window from an interval down to a single instant. Hold that thought for the next tab.

Latch vs. Flip-Flop: Level vs. Edge

Everything so far has been level-sensitive. The flip-flop makes one decisive change: it responds not to the level of a control signal but to its transition β€” the clock edge. On the rising (or falling) edge, the device samples its inputs, updates once, and then ignores everything until the next edge.

FeatureLatchFlip-Flop
SensitivityLevel-sensitiveEdge-triggered
When output changesWhile enable is activeOnly on the clock edge
Timing styleMore asynchronous-like behaviorSynchronous behavior
Typical useTemporary storage and gatingRegisters, counters, and synchronous state machines

Why the Edge Wins in Big Systems

  • Predictability: every storage element in the system updates at the same instant. Between edges, all signals are free to ripple through combinational logic β€” nothing gets stored until the next tick.
  • Noise immunity: the vulnerable window shrinks from the whole enable interval to the tiny setup/hold window around the edge. Input glitches at any other time are simply invisible.
  • Composability: chain a thousand flip-flops on one clock and the design still behaves β€” the discipline behind every synchronous processor, FPGA, and memory controller.

Reading the Symbol

The triangle (β–·) on the clock pin is the flip-flop's badge: it means "edge-triggered here." A plain triangle means rising-edge; a bubble in front of it means falling-edge. Latch symbols have no triangle β€” a plain EN pin means level-sensitive.

πŸ’‘ The One-Sentence Version
A latch is a window (data flows while it's open); a flip-flop is a camera (one snapshot per click, immune to everything between shots). The Lab makes this visceral: watch Q chase D in D-Latch mode, then switch to D Flip-Flop and watch Q ignore D until you pulse the clock.

SR and D Flip-Flops β€” and the Clock Enable

SR Flip-Flop

The edge-triggered counterpart of the SR latch. On the active clock edge: S=1 drives Q high, R=1 drives Q low, and S=R=0 preserves the current state. Between edges, S and R can do anything without effect. It inherits the SR family curse β€” S=R=1 at the edge is still undefined β€” which limits it to control systems where separate, mutually exclusive set and reset commands are guaranteed by design.

D Flip-Flop: The One-Bit Memory Cell

Characteristic equation:  Qnext = D   (sampled at the active edge)

Q takes the value on D at the edge instant, then ignores all later D changes until the next edge. That's the whole device β€” and that simplicity is why it dominates: it is the classic one-bit memory cell for synchronous systems. Set D early, clock the system, and the value is captured cleanly with no invalid states and no ambiguity.

Applications: registers, shift registers, pipeline stages, counters, and synchronous data transfer β€” essentially all of modern digital design's storage is D flip-flops in bulk.

D Flip-Flop with Enable (Clock Enable)

Adds a conditional-load input: EN=1 β†’ load new data on the edge; EN=0 β†’ hold the old value even though the clock keeps running. This is the standard way to make storage conditional without touching the clock wiring β€” gating the clock itself invites glitches and timing skew, while a clock enable keeps the clean global clock and simply tells the flip-flop "skip this one."

Applications: register files (only the addressed register loads), state retention, and controlled pipeline updates (stalling a stage without stopping the clock).

🎯 Quiz Tip
"Q changes only at the clock edge" is the discriminator the exam will probe. If a question shows D changing three times between two clock edges, only the value present at the edge matters β€” the other changes never happened as far as Q is concerned. Prove it to yourself in the Lab's edge-capture exploration.

The JK Flip-Flop: The Universal One

The JK is the SR flip-flop with its one flaw engineered away. Internal feedback from Q and Q̅ steers the inputs so that the formerly forbidden both-asserted case becomes something useful: toggle.

Operation (at each active clock edge)

JKQnextOperation
00QHold β€” keep the stored value
101Set
010Reset
11Q̅Toggle β€” invert on every edge

Why "Universal"

The JK can impersonate every other flip-flop, which is why it earned the name universal flip-flop:

  • As a D flip-flop: drive K with the inverse of J (K = J̅) β€” now J acts exactly like a D input.
  • As a T flip-flop: tie J and K together β€” the shared input becomes T (0 = hold, 1 = toggle).
  • As an SR flip-flop: use J as Set and K as Reset, with the bonus that the "both asserted" case is now defined and safe.

Applications: counters (the toggle mode is precisely what binary counting needs), toggle circuits, and flexible sequential logic design where one part number must cover many roles β€” the reason classic TTL families led with the 7476 dual JK.

πŸ’‘ The Design Lesson Inside the JK
Notice the engineering pattern across three tabs: the SR latch had a forbidden state; the D latch eliminated it by restricting inputs; the JK redefined it as a new feature. Two valid strategies for the same flaw β€” constraint versus repurposing β€” and both are all over real-world circuit design.

The T Flip-Flop and Frequency Division

Strip the JK down to its most celebrated trick and you get the T (toggle) flip-flop β€” a single input device:

T = 1 β†’ Q toggles on each active clock edge   |   T = 0 β†’ Q holds   (Qnext = T βŠ• Q)

The Divide-by-2 Miracle

With T=1, Q inverts on every active edge. Follow the arithmetic: the clock must rise twice for Q to complete one full 0β†’1β†’0 cycle. Therefore:

fQ = fCLK / 2   β€” and chaining n toggle stages gives  fout = fCLK / 2ⁿ
  • One stage: 1 MHz in β†’ 500 kHz out, a perfect 50% duty-cycle square wave regardless of the input's duty cycle.
  • Chain of stages (each Q clocking the next stage): Γ·2, Γ·4, Γ·8, Γ·16 … Read the chain's outputs together and they count in binary β€” a ripple counter is nothing but T flip-flops holding hands.
  • Fifteen stages: 32,768 Hz Γ· 2¹⁡ = exactly 1 Hz β€” which is literally how a quartz watch turns its crystal into seconds.

Applications: binary counters, frequency division, clock prescalers, and simple state toggling (a push-on/push-off power button is one T flip-flop).

🎯 See the Division Happen
In the Lab, select T FF, set T=1, and switch on auto-clock. Now read the timing diagram: the CLK lane completes two full cycles for every one cycle of the Q lane. That 2:1 picture is frequency division β€” count the edges yourself.

Operations Vocabulary & Where These Devices Live

The Five Operations β€” Precise Definitions

OperationMeaning
SetForcing Q to 1.
Reset / ClearForcing Q to 0.
HoldKeeping the previously stored value.
ToggleInverting the stored state on the next active clock event.
TransparentOutput follows the input while enabled (latches only).

The Application Map

ApplicationHow Latches/Flip-Flops Deliver ItBest Device
One-bit storageThe bistable core holds a bit indefinitely β€” the atom of all sequential circuitsAny; D FF in synchronous designs
Registersn flip-flops on one clock capture an n-bit word in a single edgeD FF (with clock enable for write control)
Shift registersEach Q feeds the next D; bits march one position per clock β€” serial↔parallel conversionD FF chain
CountersToggle stages chained so each divides by 2; outputs read as a binary countT or JK FF
Frequency divisionEach toggle stage halves the clock β€” prescalers, timekeepingT FF
Flags & control logicLatch an event (fault, alarm, request) until acknowledged and clearedSR latch
State machinesFlip-flops store the current state; gates compute the next β€” the pattern behind every controllerD FF + combinational logic
Input synchronizingTwo cascaded D FFs tame an asynchronous outside signal before it meets the clocked system, containing metastabilityD FF pair
Controlled data transferLatches grab bus data during valid windows; clock-enabled FFs load only when addressedD latch / D FF + EN
πŸ’‘ Course Thread
Diodes steered current (L1), supplies delivered it (L2), transistors switched it (L3), feedback made it precise (L4), gates made it logical (L5) β€” and now bistables give the logic a memory. Lesson 7 puts these cells to work in force: registers, counters, and the sequential systems that run on them.

πŸš— Level vs. Edge: Two Paired Analogies

Tab 5 compressed the whole distinction into "window vs. camera." Here are two fuller analogies built as a matched pair β€” same street, same cars, same one-bit question ("is a car there?") β€” so the only thing that differs between them is when the answer gets recorded. That is exactly the difference between a latch and a flip-flop.

Level-sensitive (latch family)Edge-triggered (flip-flop family)
Analogy 1 Β· Level-sensitive Β· D latch

The One-Car Garage Door

ONE-CAR GARAGE = ONE BITdoor up: contents follow the drivewayneighbor turning around β€”stored if door drops now!OPENER HELDEN = 1car inside = Q = 1 Β· empty = Q = 0

You hold the opener button, and the door stays up as long as you hold it. While it's up, the garage's contents simply follow the driveway: a car pulls in β€” occupied; it backs out β€” empty; it pulls in again β€” occupied. The garage is transparent. Release the button, the door comes down, and whatever is inside at that moment stays there, no matter what happens on the driveway afterward.

The danger is the open interval. If a neighbor noses in to turn around just as the door drops, the neighbor's car is what you've stored. Every glitch on the input during the window can end up as the answer.

Button held (EN=1) β†’ contents follow driveway (Q = D)
Button released (EN=0) β†’ door down, contents frozen (hold)
Analogy 2 Β· Edge-triggered Β· D flip-flop

The Red-Light Camera

intersection (the data: car here or not?)GREEN β†’ RED= the clock EDGEearlier car: ignoredlater cars:ignoredQ = 1snapshot per change

A red-light camera doesn't care how long the light has been red or green. It fires once, at the instant the signal changes to red, and records one fact: was a car in the intersection at that instant? The photo is kept until the next change. Cars that crossed a second earlier, or roll through a second later, never appear in it.

Its only vulnerable moment is the flash itself. A car sitting exactly on the stop line is the camera's version of a setup/hold violation β€” was it in or out? That ambiguous photo is the traffic-court equivalent of metastability.

Light turns red (rising CLK edge) β†’ one snapshot: Q = D at that instant
Any other time β†’ camera blind (hold)

Mapping the Analogies onto the Circuit

Circuit elementπŸšͺ Garage door (level)πŸ“Έ Red-light camera (edge)
Control signalOpener button held down (EN = 1 for as long as it's held)The signal changing to red (the rising clock edge)
Data input D"Is a car in the space right now?""Is a car in the intersection right now?"
Output QCar in the garage (1) or empty (0)The photo: car (1) or no car (0)
Transparent / followingYes β€” contents track the driveway while the door is upNever β€” the camera is blind between changes
HoldDoor down: contents locked inBetween changes: the last photo stands
Input glitchNeighbor turning around can be capturedCars passing mid-cycle are never recorded
Vulnerable windowThe entire time the door is upOnly the instant of the flash (setup/hold)
Real part74HC373 / 74HC75 (D latches)74HC74 / 74HC574 (D flip-flops)

See It: Same Input, Two Devices

This diagram feeds the identical D waveform to a D latch and a D flip-flop, and uses the same square wave as the latch's EN and the flip-flop's CLK. Shaded bands are the latch's open windows ("door up"); amber dashed lines are the flip-flop's rising edges ("flash"). Generate new patterns and compare how often each Q changes. Try the glitchy pattern: single-step spikes inside a shaded band leak through the latch but almost never reach the flip-flop.

⚠️ Where the Analogies Stop Being Accurate
A real garage door takes seconds to move; a latch responds in nanoseconds (its propagation delay). A real camera needs light and a shutter; a flip-flop's "flash" is a master-slave or pulse-capture circuit inside the chip, and its setup/hold window is measured in picoseconds to nanoseconds. And both analogies store one yes/no fact β€” the one-car garage is deliberately small. A register is simply a row of garages (or cameras) sharing one button (or one traffic signal).
🎯 Classroom Activity: Human Latch vs. Human Flip-Flop (5 minutes)
Pick two students. The instructor raises and lowers a hand at random (that's D). Student A is the latch: whenever a second student holds up a green card (EN), A mirrors the instructor's hand continuously; when the card drops, A freezes. Student B is the flip-flop: B may move only at the instant the instructor claps (the clock edge), copying the hand position at that clap. Run 30 seconds, then ask the class: who moved more? Who copied the "mistake" when the instructor twitched? The class reconstructs the timing diagram above from memory.

Quick Check: Level or Edge?

Classify each everyday situation. Instant feedback appears after each choice.

πŸ“ˆ Sequential Logic Lab β€” Operation Simulator

All eight devices from the symbol library, live. The left side of the canvas shows the device with its current input and output states; the right side is a scrolling timing diagram recording everything you do. Toggle inputs with the buttons (or click the input pins on the canvas), pulse the clock manually to see edge-triggering, or switch on the auto-clock and watch behaviors like divide-by-2 draw themselves.

πŸ’‘ Input pins on the device symbol are clickable too.

Auto-clock (free-running)
πŸ’‘ Guided Explorations
1. Memory itself (SR Latch): pulse S on then off β€” Q stays set with both inputs at 0. That hold is the bistable remembering. 2. The forbidden state: set S=1 and R=1 β€” read the red INVALID warning, then release both and notice the outcome is arbitrary. 3. Gating (Gated SR): wiggle S with EN=0 β€” nothing; raise EN β€” instant response. 4. Transparency (D Latch): toggle D rapidly with EN=1 and watch Q chase it in the timing lanes; drop EN and the chase freezes. 5. The camera (D FF): change D two or three times without pulsing the clock β€” Q ignores everything; now pulse once β€” Q captures only the value at the edge. 6. Universal toggle (JK): J=K=1, auto-clock on β€” Q flips every rising edge. 7. Divide-by-2 (T FF): T=1, auto-clock on β€” count edges in the CLK lane vs the Q lane: exactly 2:1, frequency division drawn live.

🏭 Applications Gallery: One Worked Example per Device

Tab 9's Application Map tells you which device fits each job. This gallery shows how: one concrete, buildable circuit for each of the eight devices, with an illustration, the reason that device (and not its neighbor) is the right choice, and a representative part number you can find on a datasheet. Each "Try it" button loads that device in the Sequential Logic Lab.

Latch (level-sensitive)Flip-flop (edge-triggered)
SR Latch

The Switch Debouncer

SPDT pushbuttonCOMSRQQ̅clean outputcontactQbounces = HOLD
Scenario. A mechanical pushbutton doesn't close cleanly: its contacts bounce 5–20 times over a few milliseconds. A counter watching the raw contact would count one press as a dozen.
How the device does it. A single-pole double-throw switch drives S from one contact and R from the other. The first touch of the new contact sets (or resets) the latch. Each bounce only lifts that input back to 0 β€” and S=R=0 is the hold condition. The bounces are absorbed by memory.
Why this device. The blade physically cannot touch both contacts at once, so S=R=1 can never happen. The SR latch's one flaw is designed out by the mechanics. (Practical builds use a NAND-based S̅R̅ latch with pull-up resistors and active-low inputs; the logic is identical.)
Parts: 74HC279 quad S̅R̅ latch Β· also: fault and E-stop flags
Gated SR Latch

The Armed Security Alarm

door sensorARM keyRESETSENRQEN = 0 (disarmed): door opens freely, Q holds 0EN = 1 (armed): one opening sets Q; siren stays ON
Scenario. A security panel must ignore the door while the owner is home, but once armed, a single door opening must keep the siren sounding even after the intruder closes the door.
How the device does it. Door sensor β†’ S, arm key β†’ EN, reset button β†’ R. Disarmed (EN=0), the latch ignores the door entirely. Armed (EN=1), the first opening sets Q; when the door closes, S returns to 0 and the latch holds β€” the siren stays on until RESET.
Why this device. The enable supplies the "listening window," the SR core supplies event memory. Design caution: pressing RESET while the door is still open (armed) is S=R=1. Real panels add priority logic so reset or alarm wins by rule, never by race.
Parts: 74HC75 / gates + SR core Β· also: sample-window fault capture
D Latch

The Address Latch on a Multiplexed Bus

CPU8051-styleAD0–AD7 (address, then data)D latch Γ—874HC373ALE β†’ ENMemoryA0–A7 heldAD busALEADDRDATAEN falls β†’ address frozen
Scenario. To save pins, 8051-family microcontrollers send the low address byte and the data over the same eight wires, one after the other. The memory chip needs the address to stay put while the data arrives.
How the device does it. The CPU places the address on AD0–AD7 and raises ALE (Address Latch Enable), wired to the latches' EN. While ALE=1, the latches are transparent, so the address flows straight to the memory. ALE falls just before the bus switches to data, freezing the address on A0–A7.
Why this device. Here transparency is a feature: the address reaches memory immediately, with no wait for a clock edge. The only timing requirement is that the address be valid when ALE falls β€” the garage door closing.
Parts: 74HC373 octal D latch Β· also: holding a reading for a slow display
SR Flip-Flop

Synchronous Start/Stop Conveyor Control

STARTSTOPSYS CLKSCLKRQMbelt runs while Q = 1
Scenario. A packaging-line controller runs a conveyor from debounced START and STOP buttons. Every other part of the controller (warning horn, jam timer) runs on the same system clock.
How the device does it. START β†’ S, STOP β†’ R, system clock β†’ CLK. On each rising edge the controller samples both buttons: START sets Q (motor runs), STOP resets it, neither holds. The motor command changes in lockstep with the rest of the controller, so the horn timer and motor always start on the same tick.
Why this device. Separate set and reset commands match how operators think. But S=R=1 at an edge is still undefined, so industrial logic makes STOP dominant (S is gated by STOP̅). The safety rule "stop always wins" is exactly the invalid-state fix.
Parts: built from a D FF + gating logic, or inside a PLC/FPGA
D Flip-Flop

The Shift-Register LED Driver

SERCLK (shared)DQQ0DQQ1DQQ2DQQ3each rising edge: every bit steps one place to the right
Scenario. A microcontroller with three free pins must drive 8, 16, or 64 LEDs.
How the device does it. D flip-flops are chained Q→D on a shared clock. On each rising edge, every bit moves one stage to the right while a new bit enters at SER. After eight clocks, an 8-bit pattern sits across eight outputs.
Why this device. All stages sample at the same instant, so each one grabs its left neighbor's old value before that neighbor changes. Build the same chain from transparent latches and one enable window would let a bit race through the entire chain at once β€” the garage door problem, eight garages deep.
Parts: 74HC595 (shift + output register) Β· also: two-FF synchronizer, pipelines
D Flip-Flop + Enable

The Display-Hold Register in a Digital Meter

ADCfast, jitteryD FF + EN Γ—12DENCLK3.274steady readoutEN: 2 Hz tickCLK: 1 MHzloads only when EN = 1the clock never stops
Scenario. A multimeter's ADC produces thousands of readings per second. Shown directly, the last digits would blur into an unreadable flicker.
How the device does it. The reading feeds a bank of clock-enabled D flip-flops. The 1 MHz clock never stops, but EN goes high for just one clock period twice per second (and stays low while the HOLD button is engaged). Only those edges load; every other edge is skipped.
Why this device. Clock enable makes storage conditional without gating the clock, which would invite glitches and skew. It's the same trick a CPU register file uses: all registers see the clock, only the addressed one sees EN=1.
Parts: 74HC377 octal D FF with enable Β· FPGA flip-flops (CE pin)
JK Flip-Flop

The 3-Bit Event Counter

falling-edge JKs (bubble before β–·), J = K = 1 β†’ togglesensorJKQ11Q0 (Γ·2)JKQ11Q1 (Γ·4)JKQ11Q2 (Γ·8)after 5 pulses: Q2 Q1 Q0 = 1 0 1 = 5
Scenario. Count cars entering one level of a parking garage (0–7), or any stream of pulses from a sensor.
How the device does it. Three JKs with J=K=1 are in toggle mode. Sensor pulses clock stage 0; each stage's Q clocks the next. With falling-edge devices, a stage triggers when the previous Q drops 1β†’0 β€” which is exactly a binary carry. Stage 0 toggles every pulse, stage 1 every two, stage 2 every four.
Why this device. Toggle mode is binary counting, and JK universality means one stocked part can be a counter stage today and a set/reset flag tomorrow. (With rising-edge parts, clock each stage from the previous Q̅.) Lesson 7 fixes this ripple counter's accumulating delay with a synchronous design.
Parts: 74HC73 / 74HC107 dual JK, negative-edge
T Flip-Flop

The Quartz Watch Divider

32,768 HzT÷2T÷4T÷2¹⁡···1 Hz1 tick/sCLKQ1 ÷2Q2 ÷4each stage halves its input frequency
Scenario. A watch crystal oscillates at 32,768 Hz, far too fast to step a seconds hand.
How the device does it. A chain of T flip-flops with T=1, each clocked by the previous stage's output. Every stage halves the frequency with a perfect 50% duty cycle. After 15 stages, 32,768 ÷ 2¹⁡ = exactly 1 Hz.
Why this device. Toggle-and-halve is the whole job, so the simplest flip-flop wins. The crystal frequency was chosen as a power of two for this reason. Same device, other job: a debounced button clocking one T flip-flop gives push-on/push-off lamp control.
Parts: CD4060 (oscillator + 14 stages β†’ 2 Hz) plus one more T stage β†’ 1 Hz
πŸ’‘ Pattern Across the Gallery
Notice which applications chose a latch: the debouncer, the alarm, and the bus latch all want immediate response or event capture, and each guarantees its inputs are quiet or exclusive. Every application that chains devices together or shares a system clock β€” shift register, meter, counter, divider β€” chose a flip-flop. That is the garage-vs-camera distinction showing up as an engineering decision.

Key Facts Reference Box

Bistable Element
Two stable states = one stored bit
Latch
Level-sensitive β€” follows inputs while enabled
Flip-Flop
Edge-triggered β€” updates only at clock edge
SR Latch Rules
S→Q=1 · R→Q=0 · 0,0→hold
SR Invalid State
S=R=1 β†’ race / metastability
Gated SR
EN=0 ignores inputs and holds
D Latch
EN=1: Q follows D (transparent) Β· no invalid state
D Flip-Flop Equation
Qnext = D (at the edge)
Clock Enable
EN=0: skip the load, keep old value
JK Modes
00 hold Β· 10 set Β· 01 reset Β· 11 toggle
JK = Universal
Emulates D (K=J̅) and T (J=K)
T Flip-Flop
Qnext = T βŠ• Q Β· T=1 toggles
Frequency Division
Toggling stage: fQ = fCLK ÷ 2 (n stages: ÷2ⁿ)
Edge Triangle β–·
Symbol mark for edge-triggered clock pin
Setup / Hold Time
Data must be stable around the edge
Level Analogy
Garage door: contents follow while open
Edge Analogy
Red-light camera: one snapshot per change
The Five Operations
Set Β· Reset Β· Hold Β· Toggle Β· Transparent

Interactive Knowledge Check

Test your understanding with ten questions. Select your answers and click "Submit Answers" for your score and detailed feedback.

Score: 0 / 10

Please complete all questions to view your results.

← Lesson 5: Gates & Boolean Algebra 🏠 ELT 102 Home Next: Lesson 7 β†’