EuraStudy
Notes/Electronics/Sequential logic systems
Notes · ElectronicsUK · A-Levels

Sequential logic systems

Sequential logic adds memory to the gates of the previous chapter: its outputs depend on past inputs as well as present ones. This chapter develops the NAND latch as a one-bit store, the edge-triggered D-type flip-flop, and the ripple, decade and synchronous counters and registers built from them, including their use as frequency dividers.

4 sections·~15 min reading time·3 competencies·Level Standard 2 · Advanced 2

T·0555 / 16
Exam profile
AO1 · Describe the NAND latch, the D-type flip-flop and ripple, decade and synchronous counters.AO2 · Complete flip-flop timing diagrams and counter state sequences and calculate division ratios.AO3 · Design a divide-by-n counter and choose the reset logic to give a required modulus.
Operators:describecompletedeterminedesignanalysecalculateevaluate

basic level

At AS the focus is the NAND latch as a memory element and the D-type flip-flop, including its use to divide a clock by two.

higher level

The full A-Level develops multi-stage ripple counters, modulo-n and decade counters with reset logic, synchronous counters and shift registers.

Depth

Reading depth: In depth

Text

Text size: Standard

Contents · 4 sections▾
  1. Sequential logic systems
    • 01The NAND latch◐
    • 02The D-type flip-flop◐
    • 03Ripple counters and frequency division●
    • 04Modulo-n and synchronous counters●
§ 01

The NAND latch#

●●○StandardLPWJEC/Eduqas A Level Electronics — Unit 2 Digital Electronics (latches)

Cross-coupled NAND latch

NAND SR latchGraph, SET (active low) → NAND 1, RESET (active low) → NAND 2, NAND 1 → Q, NAND 2 → Q-bar, Q → NAND 2, Q-bar → NAND 1SET (activelow)RESET (activelow)NAND 1NAND 2QQ-barcross-couplecross-couple
Fig. 1The two NAND gates are cross-coupled: each output feeds back to the other gate's input, giving the circuit its memory.

Key points

A latch is the simplest memory element: a circuit that can hold a single bit indefinitely. The set-reset (SR) latch is built from two NAND gates cross-coupled, so that each gate's output feeds back to an input of the other. This feedback is what gives the circuit memory — its output depends not only on the present inputs but on the state it is already in, which is the defining feature of sequential logic.
The NAND latch has two active-low inputs, conventionally labelled S‾\overline{S}S (set) and R‾\overline{R}R (reset), and two complementary outputs QQQ and Q‾\overline{Q}Q​. Taking S‾\overline{S}S low (to 0) forces QQQ to 1 (set); taking R‾\overline{R}R low forces QQQ to 0 (reset). With both inputs high (their inactive state) the latch simply holds whatever it was last set to — the memory condition. This is how a single bit is stored: pulse one input to write it, then leave both inputs inactive to retain it.
One input combination must be avoided. Taking both S‾\overline{S}S and R‾\overline{R}R low at the same time drives both outputs to 1, so QQQ and Q‾\overline{Q}Q​ are no longer complementary — the outputs are ambiguous, and when the inputs are released the final state is unpredictable. This is the forbidden (invalid) state of the SR latch, and any design must ensure the two inputs are never asserted together. Recognising and explaining this forbidden state is a standard exam point.
The classic application of a latch is switch debouncing. A mechanical switch bounces as its contacts make and break, producing a burst of spurious pulses that would confuse a counter. A latch set by the first clean contact ignores the subsequent bounces, delivering a single clean transition. This turns a messy real-world input into a reliable digital signal — a direct example of the input-conditioning stage of a digital system.
The latch is level-sensitive: its output can change at any time an input is active. Most sequential systems instead need a store that changes only at a precisely defined instant, so that many bits can be updated together and in step with a clock. Adding gating and edge-detection to the basic latch produces the flip-flop of the next section, which is the true workhorse of counters and registers. The latch is the conceptual seed from which all of them grow.
Qnext={1S‾=0, R‾=10S‾=1, R‾=0QS‾=1, R‾=1Q_{next} = \begin{cases} 1 & \overline{S}=0,\ \overline{R}=1 \\ 0 & \overline{S}=1,\ \overline{R}=0 \\ Q & \overline{S}=1,\ \overline{R}=1 \end{cases}Qnext​=⎩⎨⎧​10Q​S=0, R=1S=1, R=0S=1, R=1​

NAND latch behaviour

Active-low set and reset, with a hold state; both inputs low is forbidden.

NAND latch truth table

NAND latch statesTable with 5 columns and 4 rows, Data: SET · RESET · Q · Q-bar · state; 1 · 1 · Q0 · Q0-bar · hold; 0 · 1 · 1 · 0 · set; 1 · 0 · 0 · 1 · reset; 0 · 0 · 1 · 1 · forbiddenSETRESETQQ-BARSTATE11Q0Q0-barhold0110set1001reset0011forbidden
Fig. 2The four input conditions of the NAND latch: set, reset, hold, and the forbidden state where both outputs go high.
Worked example

Tracking a latch through an input sequence

A NAND latch starts with Q=0Q=0Q=0. The inputs (S‾,R‾)(\overline{S},\overline{R})(S,R) are applied in the order (0,1)(0,1)(0,1), then (1,1)(1,1)(1,1), then (1,0)(1,0)(1,0), then (1,1)(1,1)(1,1). Find QQQ after each step.

  1. 01Step 1: (0,1)

    S‾=0\overline{S}=0S=0 sets the latch, so Q=1Q=1Q=1.

  2. 02Step 2: (1,1)

    Both inputs inactive: the latch holds, so QQQ stays at 1.

  3. 03Step 3: (1,0)

    R‾=0\overline{R}=0R=0 resets the latch, so Q=0Q=0Q=0.

  4. 04Step 4: (1,1)

    Hold again: QQQ stays at 0.

Result: QQQ follows 1,1,0,01, 1, 0, 01,1,0,0 — the latch stores each command until the next set or reset, demonstrating one bit of memory.

Exam focus

  • Complete the SR (NAND) latch truth table, identifying the set, reset, hold and forbidden conditions.
  • Explain how a latch debounces a mechanical switch.

Typical mistakes

  • Forgetting that the NAND latch inputs are active-low, so a 0 (not a 1) sets or resets it.
  • Overlooking the forbidden state where both inputs are asserted and the outputs are no longer complementary.

Active revision

For a NAND (SR) latch, state the output QQQ that results from each input pair (S‾,R‾)(\overline{S},\overline{R})(S,R): (1,1), (0,1), (1,0) and (0,0), and identify which is forbidden.

Active recall

Recall the key points — then reveal.

Sources: WJEC/Eduqas GCE Electronics specification (WJEC / Eduqas)

§ 02

The D-type flip-flop#

●●○StandardLPWJEC/Eduqas A Level Electronics — Unit 2 Digital Electronics (D-type flip-flop)

D-type flip-flop truth table

D-type flip-flopTable with 3 columns and 3 rows, Data: Clock · D · Q next; rising edge · 0 · 0; rising edge · 1 · 1; no edge · X · Q (hold)CLOCKDQ NEXTrising edge00rising edge11no edgeXQ (hold)
Fig. 3The D-type captures DDD on the rising clock edge; with no edge it holds its output regardless of DDD.

Key points

A flip-flop is an edge-triggered store: its output changes only at a precise instant, the rising (or falling) edge of a clock signal, and holds steady at all other times. The D-type (data) flip-flop is the most useful. It has a data input DDD, a clock input, and outputs QQQ and Q‾\overline{Q}Q​. Its rule is beautifully simple: on the active clock edge, QQQ takes the value of DDD; between edges, whatever DDD does, QQQ does not change.
Edge triggering is the key improvement over the level-sensitive latch. Because the D-type samples DDD only at the clock edge, many flip-flops driven by the same clock all capture their inputs at exactly the same instant, keeping a whole system in step. This synchronous updating is what makes reliable counters, registers and processors possible; without it, signals rippling through a circuit at slightly different times would produce glitches and race conditions.
Connecting the inverted output Q‾\overline{Q}Q​ back to the data input turns a D-type into a toggle (T) flip-flop. Now, on each clock edge, QQQ is loaded with the opposite of its present value, so it flips between 0 and 1 on every edge. The output therefore changes state once per clock cycle, which means it completes one full cycle for every two input cycles — the flip-flop divides the clock frequency by exactly two. This single trick is the basis of every binary counter.
Real D-types usually add asynchronous set and reset (often called preset and clear) inputs that force QQQ to 1 or 0 immediately, overriding the clock. These are used to initialise a counter to a known state or to force a reset when a particular count is reached, as in the decade counter. Understanding that these inputs act at once, regardless of the clock, while DDD acts only on the clock edge, is important when reading and completing timing diagrams.
The D-type flip-flop is the fundamental one-bit register: it captures and holds a single bit on command. Chaining several so that data shifts from one to the next on each clock edge makes a shift register, used for serial-to-parallel conversion and delay; driving each from the previous stage's output makes a counter. Almost every clocked digital system is, at bottom, an arrangement of D-type flip-flops around combinational logic — which is why mastering this one device unlocks the rest of the sequential unit.
Qnext=D (on the active clock edge)Q_{next} = D \ \text{(on the active clock edge)}Qnext​=D (on the active clock edge)

D-type rule

The output takes the data value at the clock edge and holds it otherwise.

fout=fclk2 (toggle connection)f_{out} = \dfrac{f_{clk}}{2} \ \text{(toggle connection)}fout​=2fclk​​ (toggle connection)

Divide by two

With Q-bar fed back to D, the output toggles each edge, halving the frequency.

Worked example

The toggle flip-flop as a divider

A D-type flip-flop is wired with Q‾\overline{Q}Q​ connected to DDD and clocked at 8 kHz8\,\text{kHz}8kHz. Starting from Q=0Q=0Q=0, list the output after the first four clock edges and state the output frequency.

  1. 01Edge 1

    D=Q‾=0‾=1D = \overline{Q} = \overline{0} = 1D=Q​=0=1, so on the edge Q→1Q \to 1Q→1.

  2. 02Edge 2

    D=Q‾=1‾=0D = \overline{Q} = \overline{1} = 0D=Q​=1=0, so Q→0Q \to 0Q→0. Edges 3 and 4 continue 111 then 000.

  3. 03Frequency

    QQQ completes one full cycle (0,1,0,1) for every two clock cycles, so fout=fclk/2=8/2=4 kHzf_{out} = f_{clk}/2 = 8/2 = 4\,\text{kHz}fout​=fclk​/2=8/2=4kHz.

    fout=8 kHz2=4 kHzf_{out} = \dfrac{8\,\text{kHz}}{2} = 4\,\text{kHz}fout​=28kHz​=4kHz

Result: QQQ toggles 1,0,1,01,0,1,01,0,1,0 on successive edges, giving a 4 kHz4\,\text{kHz}4kHz square wave — the clock divided by two.

Exam focus

  • State the D-type rule (Q takes D on the clock edge) and complete a timing diagram for given D and clock waveforms.
  • Show that connecting Q-bar to D makes a toggle flip-flop that divides the clock frequency by two.

Typical mistakes

  • Letting Q follow D between clock edges — the D-type only samples D at the active edge.
  • Confusing the divide-by-two output frequency with the clock frequency (the output is half).

Active revision

A D-type flip-flop has its Q‾\overline{Q}Q​ output connected to its DDD input and is clocked at 2 kHz2\,\text{kHz}2kHz. Describe the output waveform at QQQ and state its frequency.

Active recall

Recall the key points — then reveal.

Sources: WJEC/Eduqas GCE Electronics specification (WJEC / Eduqas)

§ 03

Ripple counters and frequency division#

●●●AdvancedLPWJEC/Eduqas A Level Electronics — Unit 2 Digital Electronics (counters)

Four-stage ripple counter

Ripple counter (divide by 16)Graph, Clock → FF0 (Q0, /2), FF0 (Q0, /2) → FF1 (Q1, /4), FF1 (Q1, /4) → FF2 (Q2, /8), FF2 (Q2, /8) → FF3 (Q3, /16)ClockFF0 (Q0, /2)FF1 (Q1, /4)FF2 (Q2, /8)FF3 (Q3, /16)clocksclocksclocks
Fig. 4Each toggle flip-flop divides by two, so the four outputs Q0Q_0Q0​ to Q3Q_3Q3​ count in binary and the last stage is the clock divided by 16.

Key points

Chaining toggle flip-flops makes a binary counter. The clock drives the first flip-flop, whose output toggles at half the clock frequency; that output clocks the second flip-flop, whose output toggles at a quarter of the clock; and so on. Each stage divides the frequency by a further two, and the flip-flop outputs, read together, count upward in binary. Because each stage is clocked by the previous stage's output, the changes 'ripple' along the chain — hence the name ripple counter.
With nnn flip-flops the counter has 2n2^n2n distinct states, counting from 0 up to 2n−12^n - 12n−1 before rolling over to zero. Four flip-flops therefore give a modulo-16 counter that counts 000000000000 to 111111111111 (0 to 15) and divides the input frequency by 16 at the final output. This is the standard way to build a frequency divider: to divide a clock by 2n2^n2n, use nnn toggle flip-flops and take the output of the last stage.
The counter's outputs form a natural binary number, with the first stage as the least significant bit. Reading the state sequence shows the least significant bit changing on every clock, the next bit changing half as often, and so on — exactly the binary counting pattern. This makes the ripple counter simultaneously a counter (its outputs are the count) and a set of frequency dividers (each output is the clock divided by a power of two), and questions exploit both interpretations.
Ripple counters are simple and cheap but have a weakness: because each stage must wait for the previous one to change, the effect of a clock edge takes time to propagate along the chain. During this brief settling time the outputs pass through incorrect intermediate values, so a ripple counter can produce short-lived wrong states and is not suitable where the outputs are decoded at high speed. This propagation delay is the trade-off for the ripple counter's simplicity and is the reason synchronous counters exist.
As a system block, a counter is a memory-bearing process stage that turns a stream of clock pulses into a running total. It is used to divide frequencies (as in the timing of the seconds in a clock, derived by dividing a crystal oscillator), to count events from a sensor, and to generate the address sequence that steps a system through a set of operations. Recognising that counting and frequency division are two views of the same circuit is the key insight of this section.
states=2n,max count=2n−1\text{states} = 2^n, \quad \text{max count} = 2^n - 1states=2n,max count=2n−1

Counter capacity

n flip-flops give 2^n states counting 0 to 2^n minus 1.

fstage k=fclk2kf_{stage\,k} = \dfrac{f_{clk}}{2^k}fstagek​=2kfclk​​

Frequency division

The k-th stage output is the clock divided by two to the power k.

Ripple counter timing

Ripple counter waveformsLine chart: Q2 . . Q1 . . Q0 by clock pulses0123456012345678Q2 . . Q1 . . Q0clock pulsesQ0Q1Q2
Fig. 5Timing of the first three outputs: Q0Q_0Q0​ toggles every clock, Q1Q_1Q1​ half as often and Q2Q_2Q2​ half again — each stage divides by two.
Worked example

Designing a frequency divider

A ripple counter must divide a 32 kHz32\,\text{kHz}32kHz clock to 2 kHz2\,\text{kHz}2kHz. Find the number of flip-flops needed, the counter's modulus and the frequency at each stage.

  1. 01Division ratio

    32 kHz÷2 kHz=1632\,\text{kHz} \div 2\,\text{kHz} = 1632kHz÷2kHz=16, so the clock must be divided by 16=2416 = 2^416=24.

  2. 02Number of flip-flops

    Dividing by 242^424 needs 444 toggle flip-flops; the counter is modulo-16 (states 0 to 15).

  3. 03Stage frequencies

    The stage outputs are 32/2=16 kHz32/2 = 16\,\text{kHz}32/2=16kHz, 16/2=8 kHz16/2 = 8\,\text{kHz}16/2=8kHz, 8/2=4 kHz8/2 = 4\,\text{kHz}8/2=4kHz and 4/2=2 kHz4/2 = 2\,\text{kHz}4/2=2kHz at the last stage.

    fout=32 kHz24=2 kHzf_{out} = \dfrac{32\,\text{kHz}}{2^4} = 2\,\text{kHz}fout​=2432kHz​=2kHz

Result: Four flip-flops (modulo-16) give stage frequencies 16,8,416, 8, 416,8,4 and 2 kHz2\,\text{kHz}2kHz, the last being the required output.

Exam focus

  • State how many flip-flops are needed to divide a frequency by a given power of two, and give the maximum count.
  • Complete the state sequence of a ripple counter and read off the frequency at each stage output.

Typical mistakes

  • Confusing the number of states (2n2^n2n) with the maximum count (2n−12^n - 12n−1).
  • Ignoring propagation delay and assuming a ripple counter's outputs change simultaneously.

Active revision

A ripple counter must divide a 32 kHz32\,\text{kHz}32kHz clock down to 1 kHz1\,\text{kHz}1kHz. How many flip-flops are needed, what is the counter's modulus, and what is the frequency at each intermediate stage?

Active recall

Recall the key points — then reveal.

Sources: WJEC/Eduqas GCE Electronics specification (WJEC / Eduqas)

§ 04

Modulo-n and synchronous counters#

●●●AdvancedLPWJEC/Eduqas A Level Electronics — Unit 2 Digital Electronics (modulo-n, synchronous)

Decade counter state sequence

Decade (modulo-10) counterTable with 6 columns and 11 rows, Data: Pulse · Q3 · Q2 · Q1 · Q0 · Decimal; 0 · 0 · 0 · 0 · 0 · 0; 1 · 0 · 0 · 0 · 1 · 1; 2 · 0 · 0 · 1 · 0 · 2; 3 · 0 · 0 · 1 · 1 · 3; 4 · 0 · 1 · 0 · 0 · 4; 5 · 0 · 1 · 0 · 1 · 5; 6 · 0 · 1 · 1 · 0 · 6; 7 · 0 · 1 · 1 · 1 · 7; 8 · 1 · 0 · 0 · 0 · 8; 9 · 1 · 0 · 0 · 1 · 9; 10 -> reset · 0 · 0 · 0 · 0 · 0PULSEQ3Q2Q1Q0DECIMAL00000010001120010230011340100450101560110670111781000891001910 -> reset00000
Fig. 6The decade counter runs 0 to 9; on the pulse that would make ten (101010101010) the reset logic clears it back to 0, giving ten states.

Key points

A plain binary counter counts to a power of two, but many applications need a different modulus — a decade counter that counts 0 to 9, or a divide-by-six for seconds and minutes. A modulo-nnn counter is made by letting a full binary counter run and detecting the moment it reaches nnn, then using that detection to reset every flip-flop to zero. The counter therefore cycles through the states 0 to n−1n-1n−1 and jumps back to 0 on the count that would have been nnn.
The decade counter is the standard example. A four-bit counter is allowed to count normally until it reaches ten, which in binary is 101010101010. A gate that detects this pattern — an AND gate fed from the outputs that are 1 in 101010101010, namely Q1Q_1Q1​ and Q3Q_3Q3​ — produces a pulse the instant the count reaches ten, and that pulse is fed to the reset inputs. The result is a counter that runs 000000000000 through 100110011001 (0 to 9) and then resets, giving ten states — a decade.
Choosing the reset logic is the design skill. To make a modulo-nnn counter you write nnn in binary, identify which outputs are 1 in that pattern, and AND those outputs together to drive the reset. For a divide-by-six counter, n=6=110n=6=110n=6=110, so you AND Q1Q_1Q1​ and Q2Q_2Q2​; for divide-by-ten you AND Q1Q_1Q1​ and Q3Q_3Q3​. The counter never actually settles at the detected state — it appears only momentarily before the reset clears it — so the useful sequence is 0 to n−1n-1n−1.
Ripple counters, even when given reset logic, still suffer propagation delay, so for higher speeds a synchronous counter is used. In a synchronous counter every flip-flop is clocked by the same clock at the same instant, and combinational logic between the flip-flops decides which ones should toggle on each edge. Because all the outputs change together, there are no rippling intermediate states, so the outputs are clean and can be decoded reliably at high clock rates.
The trade-off is clear and examinable: a ripple counter is simpler and needs less logic but is slower and can glitch; a synchronous counter needs extra gating between the stages but is fast and glitch-free. Real counter chips are usually synchronous for this reason. Being able to design a modulo-nnn counter's reset logic, and to justify the choice between ripple and synchronous operation for a given speed requirement, is exactly the analyse-and-design reasoning the A2 paper rewards.
reset when count=n (AND of the outputs that are 1 in n2)\text{reset when count} = n \ (\text{AND of the outputs that are 1 in } n_2)reset when count=n (AND of the outputs that are 1 in n2​)

Modulo-n reset

Detect the binary pattern of n and use it to clear the counter.

Worked example

Reset logic for a modulo-6 counter

Design the reset logic for a divide-by-six (modulo-6) counter made from a binary counter, and list the states it cycles through.

  1. 01Binary of the modulus

    n=6=110n = 6 = 110n=6=110 in binary, so the outputs that are 1 are Q2Q_2Q2​ and Q1Q_1Q1​.

  2. 02Reset gate

    An AND gate fed from Q2Q_2Q2​ and Q1Q_1Q1​ goes high exactly when the count reaches 110110110; its output drives the flip-flop resets.

  3. 03State sequence

    The counter runs 000,001,010,011,100,101000, 001, 010, 011, 100, 101000,001,010,011,100,101 (0 to 5); on the next pulse it momentarily reaches 110110110, the AND fires, and it resets to 000000000.

Result: AND Q1Q_1Q1​ and Q2Q_2Q2​ to drive the reset; the counter cycles through the six states 0 to 5 before returning to 0.

Exam focus

  • Design the reset logic for a modulo-n counter by detecting the binary pattern of n.
  • Compare ripple and synchronous counters on speed, glitching and gate count.

Typical mistakes

  • Detecting the wrong count for reset — a decade counter resets on ten (101010101010), giving states 0 to 9.
  • Claiming a modulo-n counter has n+1 useful states; the detected state is cleared at once, leaving n states (0 to n-1).

Active revision

Design the reset logic for a modulo-6 counter built from a binary counter, and state the sequence of states it produces.

Active recall

Recall the key points — then reveal.

Sources: WJEC/Eduqas GCE Electronics specification (WJEC / Eduqas)

Contents

Section -- / 04

    • 01The NAND latch◐
    • 02The D-type flip-flop◐
    • 03Ripple counters and frequency division●
    • 04Modulo-n and synchronous counters●

0/4 Read

From notes into training

Sequential logic systems

Reinforce this topic with matching tasks from the question bank.

~15
min
3
Competencies
Practise

References & sources

Sources

WJEC / Eduqas

  • WJEC/Eduqas GCE Electronics specification

Previous topic

Logic systems

Next topic

Timing circuits

EuraStudy·Notes T·05·MMXXVI

Carry on to the next topic — your learning path is kept.