EAZYLife STEM LAB · MODULE 25

Sequential Logic, Flip-Flops & Memory

Discover how digital circuits remember a state, respond to clock edges, count events and move data. Build a synchronous two-bit binary counter using real logic ICs.

Free open lessonSequential digital logicPractical binary counter
STATE · CLOCK · MEMORY
01 · CIRCUITS THAT REMEMBER

What makes a circuit sequential?

In Module 24, combinational logic produced outputs from the present inputs. A sequential circuit can also depend on information stored from an earlier moment. That stored information is called state.

Combinational logic

InputsLogicOutput

There is no intended stored state. Change the inputs and the output follows after propagation delay.

Sequential logic

InputsClockLogicStored stateOutputFeedback

Stored state feeds back into the decision process. Clocked circuits update state at defined instants.

Remember: memory does not always mean a computer memory chip. A single latch or flip-flop can store one binary bit.

02 · LATCHES

A latch stores a bit while enabled

A latch is a level-sensitive storage element. A basic SR latch responds directly to its set and reset inputs; a gated latch adds an enable signal so it accepts input changes only while enabled and holds its state while disabled.

Cross-coupled NOR SR latch

SRQQ̅NORNOR

In an active-HIGH NOR latch, S=1 sets Q=1 and R=1 resets Q=0. With S=R=0 it holds. S=R=1 is forbidden because both outputs are forced LOW, breaking the complementary-state relationship.

SR latch truth table (NOR version)

SRNext QMeaning
00HoldRemember
010Reset
101Set
11InvalidForbidden

This table describes the active-HIGH NOR implementation. NAND SR latches use active-LOW inputs and a different truth table.

03 · FLIP-FLOPS

Store state on a clock event

A flip-flop is an edge-triggered storage element. A positive-edge-triggered flip-flop samples its input at the rising edge of the clock. It holds its output between active edges, subject to its timing and electrical limits.

Clock edge and state update

CLKDQ↑↑Q updates at the active clock edge, not continuously

Conceptual timing only. Real devices specify setup time, hold time, propagation delay, minimum clock pulse width and maximum clock frequency.

Common flip-flop types

  • D flip-flop: next Q = D at the active clock edge. Widely used for registers and pipelines.
  • JK flip-flop: J=K=1 toggles; 10 sets; 01 resets; 00 holds.
  • T flip-flop: T=1 toggles at each active edge; T=0 holds.
  • SR flip-flop: set/reset storage with a device-specific invalid or restricted input combination.

Many ICs also provide asynchronous preset and clear inputs that can change state without waiting for the clock.

Compare the next-state rules

TypeInputsNext state at active edge
DDQ(next) = D
JKJ, K00 hold · 01 reset · 10 set · 11 toggle
TT0 hold · 1 toggle
SRS, R00 hold · 01 reset · 10 set · 11 device-specific invalid/restricted
04 · INTERACTIVE FLIP-FLOP BENCH

Experiment with stored state

Select a flip-flop type, change its inputs and apply a clock edge. The teaching model updates the stored Q state according to the selected next-state rule. It does not model analogue timing, metastability or a specific IC.

STORED Q0
COMPLEMENT Q̅1

Initial state Q=0. Change D, then apply a rising edge to sample it.

State transition table

Input combinationNext Q if current Q=0Next Q if current Q=1

The table changes with the selected flip-flop type.

05 · CLOCKS AND TIMING

Why timing matters

Clock signal

Period THIGH timeLOW time

Frequency is the number of cycles per second: f = 1/T. A 2 Hz clock has a period of 0.5 seconds.

Important timing terms

  • Setup time: how long data must be stable before the active edge.
  • Hold time: how long data must remain stable after the edge.
  • Propagation delay: time from clock edge to output change.
  • Clock skew: difference in clock arrival time between devices.
  • Metastability: an uncertain temporary state that can occur when timing requirements are violated.
  • Debouncing: preventing multiple transitions from one mechanical button press.

Clock divider and toggle behaviour

A T flip-flop toggles once per active clock edge. If it toggles on every rising edge, its output frequency is half the clock frequency. Cascading stages can divide frequency by 4, 8, 16 and so on.

fOUT = fIN ÷ 2ⁿ

For n ideal divide-by-two stages. Actual maximum frequency and timing depend on the device and circuit implementation.

06 · COUNTERS AND REGISTERS

Build larger functions from stored bits

Ripple counter

FF0FF1FF2CLK÷2÷2÷2Q2

Each stage is clocked by the previous stage's output. It is simple, but delays accumulate through the chain and outputs do not all change simultaneously.

Synchronous counter

Next-statelogicFF0FF1Shared CLKQ0Q1

All flip-flops receive the same clock edge. Combinational logic calculates the next state. This avoids ripple clocking but still requires timing analysis.

Shift registers

FF0FF1FF2FF3Serial inSerial outShared clock

Each clock edge moves stored data one stage. Shift registers can convert serial data to parallel data or parallel data to serial form.

Registers and memory

  • A register stores a group of bits, often used inside a processor or controller.
  • A shift register moves bits between positions.
  • A counter follows a defined sequence of states.
  • RAM and other memory technologies store much larger collections of bits using different cell architectures.
  • Flip-flops are a foundation for registers, state machines and many digital systems.
07 · INTERACTIVE COUNTER

Step through a two-bit binary counter

Each clock edge advances this modulo-4 counter. Reset returns it to 00. This is a logical state model, not a timing-accurate simulation of a particular IC.

COUNT0
BINARY Q1 Q000
DECIMAL RANGE0–3
Q1 · MSB
Q0 · LSB

Ready at 00. Apply a clock pulse to advance the count.

Clock edgesQ1Q0Decimal
0000
1011
2102
3113
4000
08 · PRACTICAL BUILD

Build a synchronous two-bit binary counter

We will use a dual positive-edge-triggered D flip-flop and an XOR gate to create a counter whose two storage bits update on the same clock edge. A 555 timer from Module 10 can provide a slow clock, or a suitable logic-level clock source can be used.

How the next-state logic works

Let Q0 be the least significant bit and Q1 the most significant bit. The next-state equations are:

D0 = Q̅0
D1 = Q1 ⊕ Q0

Both D flip-flops share the same clock. At each rising edge, Q0 toggles. Q1 toggles only when the current Q0 is HIGH. The sequence is 00 → 01 → 10 → 11 → 00.

D FF · Q0D0 = Q̅0D FF · Q1D1 = Q1 XOR Q0XORShared CLKQ0Q1

Functional block diagram. Use the pin-level wiring guide below for the actual IC connections.

Components and equipment

  • One 74HC74 dual D flip-flop IC (DIP-14).
  • One 74HC86 quad XOR IC (DIP-14).
  • Two LEDs and two 1 kΩ current-limiting resistors.
  • Two 100 nF ceramic bypass capacitors, one per IC.
  • One 10 kΩ pull-up resistor and one normally-open reset pushbutton.
  • Regulated 5 V current-limited extra-low-voltage supply.
  • Clock source: a 555 astable circuit configured near 1 Hz, or a suitable debounced logic-level clock source.
  • Breadboard, jumper wires and multimeter.

74HC74 and 74HC86 pin connections

IC / pinConnectionPurpose
74HC74 pin 14+5 VSupply
74HC74 pin 7GNDGround
74HC74 pins 4 and 10+5 VInactive asynchronous PRE̅ inputs
74HC74 pins 1 and 13Tied together; 10 kΩ to +5 V; reset button to GNDActive-LOW asynchronous clear
74HC74 pin 3 (CLK1)Clock sourceShared rising-edge clock
74HC74 pin 11 (CLK2)Same clock sourceShared rising-edge clock
74HC74 pin 2 (D0)Pin 6 (Q̅0)Toggle Q0 each edge
74HC74 pin 5 (Q0)LED through 1 kΩ to GND; 74HC86 pin 2Least significant bit and XOR input
74HC74 pin 6 (Q̅0)74HC74 pin 2 (D0)Complement feedback
74HC74 pin 12 (D1)74HC86 pin 3 (XOR output)Next state for Q1
74HC74 pin 9 (Q1)LED through 1 kΩ to GND; 74HC86 pin 1Most significant bit and XOR input
74HC86 pin 14 / pin 7+5 V / GNDXOR IC supply
74HC86 pin 1 / pin 274HC74 pin 9 (Q1) / pin 5 (Q0)XOR inputs
74HC86 pin 374HC74 pin 12 (D1)XOR output to second D input
Both ICs100 nF from pin 14 to pin 7, close to each packageLocal supply bypassing

DIP-14 pin numbering is viewed from above, notch at the top, counter-clockwise. Confirm the exact manufacturer's datasheet and pinout before wiring.

Build and test sequence

  1. Disconnect power. Place both ICs across the breadboard centre gap and identify pin 1 by the notch or dot.
  2. Connect each IC's pin 14 to +5 V and pin 7 to GND. Install a 100 nF bypass capacitor at each IC.
  3. On the 74HC74, connect PRE̅ pins 4 and 10 to +5 V. Tie CLR̅ pins 1 and 13 together, add a 10 kΩ pull-up to +5 V and a reset button to GND.
  4. Connect both clock pins 3 and 11 to the same clock source. Confirm the clock swings between valid LOW and HIGH levels and starts at a LOW level before its first rising edge.
  5. Connect D0 pin 2 to Q̅0 pin 6. Connect Q1 pin 9 and Q0 pin 5 to 74HC86 pins 1 and 2. Connect XOR output pin 3 to D1 pin 12.
  6. Connect Q0 pin 5 and Q1 pin 9 each through a 1 kΩ resistor to an LED anode; connect LED cathodes to GND.
  7. Inspect all connections and power the current-limited 5 V supply. Press reset briefly, then release it. Apply slow clock pulses.
  8. Observe 00, 01, 10, 11, then 00. Verify both bits change on the same active clock edge.

Expected sequence and troubleshooting

PulseQ1 Q0Decimal
Reset000
1011
2102
3113
4000
  • Random start: use the active-LOW clear input to establish 00 before counting.
  • Counter does not advance: check clock reaches both clock pins and has clean rising edges.
  • Q0 does not toggle: check D0 is connected to Q̅0 and preset/clear pins are at inactive HIGH.
  • Q1 sequence is wrong: check Q1 and Q0 reach the XOR inputs and XOR output reaches D1.
  • Unstable operation: check common ground, local bypass capacitors, short wiring and unused inputs.
  • Multiple counts per button press: a mechanical switch bounces; use a proper debouncer such as a Schmitt-trigger circuit or a verified debounced clock source.

Important: the 74HC74 preset and clear inputs are active LOW. Never leave them floating. Do not assert preset and clear simultaneously. Do not connect a raw bouncing pushbutton directly to the clock and expect one clean count. Check the exact IC supply range, input thresholds, output current and timing specifications for the manufacturer and device suffix you have.

09 · KNOWLEDGE CHECK

Check what you understand

1. What is the key difference between combinational and sequential logic?

2. What happens in a positive-edge-triggered D flip-flop?

3. What is the forbidden input combination for an active-HIGH NOR SR latch?

4. Why can a pushbutton cause multiple counts?

KEEP LEARNING · GO FURTHER

Free to learn. More support when you need it.

Explore these open lessons at your own pace. For personalised explanations, project-specific troubleshooting, guided practical training or masterclasses, EazyLife offers paid support tailored to your learning goals.

Free or sponsored lesson referrals may be available through active programmes; they are not guaranteed.

Enquire about guidance