Home
LogicRoo / Sequential Circuits / D Flip-Flop Circuit
SEQUENTIAL · FLIP-FLOP

D Flip-Flop Circuit

Build a D flip-flop circuit with a 74HC74 IC. Pinout, parts list, breadboard steps, truth table, and an interactive flip-flop with a live timing diagram you can drive yourself.

Sequential logic · 1 memory IC

Change the data,
but only the clock decides when.

A D flip-flop is one bit of memory. It looks at its D input only at the instant the clock rises, stores that value in Q, and holds it until the next rising edge, however D moves in between.

1Data input
2Outputs Q, Q̄
↑Triggers on rising edge
74HC74Memory IC
Set D, then pulse CLK, or flip the view to see the timing diagram →
SCH-03 · 74HC74_DFF
mode sync
⇄ Show timing diagram
Q
Q̄
D0 Q0 Q̄1
Rising edges0 Q0
D0
CLK · pulse ↑
PRE · set Q
CLR · reset Q

Toggle D, then press CLK to store it · hold PRE or CLR to force Q · flip the view above to see the waveforms


Parts bin

What you need

One IC holds the bit. The rest is a way to feed it data, a clock, and a place to see the result.

×1 74HC74 — dual D flip-flop IC (one half used) IC1
×1 Slide switch (SPDT) — data input SW-D
×1 Pushbutton — clock SW-CLK
×2 LED — Q and Q̄ indicators LED1–2
×2 330 Ω Resistor — LED current limit R1–R2
×2 10 kΩ Resistor — D and CLK pull-down R3–R4
×1 100 nF Capacitor — supply decoupling C1
×1 Breadboard BASE
×— Jumper Wires BASE
×1 5V Supply (2–6V accepted) PWR

Reference

74HC74 pin overview (flip-flop 1)

The chip has two identical flip-flops. These are the pins of the first one.

PinNumberTypeWhat it does
VCC 14 Power Supply voltage, +2V to +6V
GND 7 Power Ground, 0V
1D 2 Input Data input, copied to Q on the clock edge
1CLK 3 Input Clock, triggers on the LOW → HIGH edge
1PRE 4 Input Preset, active LOW: forces Q = 1 at once
1CLR 1 Input Clear, active LOW: forces Q = 0 at once
1Q 5 Output The stored bit
1Q̄ 6 Output Always the opposite of Q

Behaviour

Truth table

With PRE and CLR inactive. The characteristic equation is simply Q(next) = D.

CLKDQ(next)Q̄(next)
↑ 0 0 1
↑ 1 1 0
0 / 1 / ↓ X Q Q̄

Operating principle

How a flip-flop remembers

Flip to the timing view above and toggle D and CLK to watch Q ignore everything except the rising edge.

01

Set D to the bit you want to store.

02

Nothing happens to Q while the clock is steady.

03

On the clock's rising edge, the flip-flop samples D.

04

Q holds that value until the next rising edge.

Inside, a D flip-flop is two latches chained back to back, called the master and the slave. While the clock is LOW the master follows D and the slave holds the old output. When the clock goes HIGH the master freezes and the slave copies what the master captured.

That hand-off is why the output changes only at the edge. D can wobble freely between edges and Q does not care, which is what makes flip-flops the building block of registers, counters and state machines.

The one rule is timing: D must be steady for a tiny moment before the edge (setup time) and just after it (hold time). Break that and Q can land in an undefined state.

Two control pins worth knowing

PRE (Preset): pull it LOW and Q is forced to 1 immediately, without waiting for the clock.

CLR (Clear): pull it LOW and Q is forced to 0 immediately. Handy for starting from a known state at power-up.

Both are asynchronous and active LOW. Holding both LOW at once is invalid, and the chip drives Q and Q̄ HIGH together.


Assembly

Building it on a breadboard

Six steps. The same footprint becomes one stage of a register or counter later.

Seat the 74HC74

Straddle the chip across the centre gap, notch to the left, so pins 1–7 and 8–14 land in separate rows.

Power it and park the unused half

VCC (14) to the positive rail, GND (7) to the negative rail, with the 100 nF capacitor right beside the chip. Only one of the two flip-flops is used: tie the other half's PRE and CLR (10 and 13) to VCC, and its D and CLK (12 and 11) to GND. Floating CMOS inputs pick up noise and waste power.

Disable preset and clear

PRE (4) and CLR (1) are active LOW, so tie both straight to VCC for normal operation. Left floating, they can force the flip-flop at random.

Wire the data and clock inputs

The slide switch connects D (2) to +V or GND. The clock pushbutton goes from +V to CLK (3), with a 10 kΩ resistor from CLK to GND so the pin reads a clean LOW until you press.

Add the output LEDs

Q (5) and Q̄ (6) each drive an LED through its own 330 Ω resistor to GND. Exactly one LED should be lit at any time.

Power up and test it

Set D with the slide switch, then press the clock button. Q only follows D at the instant of the press. Flip D back and forth without pressing and nothing changes.


If it misbehaves

Jumpy, stuck, or both LEDs lit

Almost always a bouncing clock button or a floating PRE/CLR pin.

  • Q toggles several times per press — the pushbutton is bouncing and sending a burst of clock edges; feed the clock from a debounced source, such as an SR-latch debouncer.
  • Q is stuck at 0 or 1 and ignores the clock — PRE or CLR is floating or LOW; tie both to VCC.
  • Both LEDs are lit — PRE and CLR are LOW at the same time, which is an invalid combination for this chip.
  • Nothing ever changes — the clock wire is on pin 11 (the second flip-flop) instead of pin 3.
  • The first state after power-up is random — that is normal. A flip-flop has no defined start state, so pulse CLR once to start from a known 0.