Skip to content
BetterDL

Binary up counter

Also called: binary counter, up counter, n-bit counter, binary up-counter

A counter whose n flip-flops hold a binary number that goes up by 1 at every active clock edge, wrapping from all 1s back to all 0s.

A binary up counter is the most common kind of counter. It uses n flip-flops, one per bit, and together they hold a number written Q₍ₙ₋₁₎…Q1Q0. Q0 is the least significant bit.

  • Each active clock edge adds 1 to the stored number.
  • After the all-1s state it wraps around to all 0s.
  • So an n-bit counter has 2ⁿ states and a modulus of 2ⁿ.

A 3-bit counter shows Q2Q1Q0 = 000, 001, 010, … , 111, then 000 again.

Why does it work? Adding 1 in binary flips the trailing 1s to 0 and the lowest 0 to 1. That gives the toggle rule: a bit toggles exactly when every bit below it is 1. A ripple counter gets that behavior by clocking each stage from the one below. A synchronous counter gets it with AND gates in front of shared-clock T flip-flops.

A handy shortcut: after k edges, an n-bit up counter that started at s holds (s + k) mod 2ⁿ. Along the way it has shown k + 1 values, counting the start.

CLKQ0Q1Q2

Worked examples

Example

Where is it after 11 edges?

A 4-bit up counter starts at Q3Q2Q1Q0 = 1101. What does it hold after 11 clock edges?

  1. 1.

    Convert the start to decimal: 1101 = 8 + 4 + 1 = 13.

  2. 2.

    Add the edges: 13 + 11 = 24.

  3. 3.

    A 4-bit counter has 2⁴ = 16 states, so take 24 mod 16 = 8. It passed 1111 and wrapped once.

  4. 4.

    Convert back: 8 = 1000.

Example

Reading the waveform

In the diagram above, CLK rises in slots 2, 4, 6, … and the counter changes in those slots. Read the three bits after the 5th edge (slot 10).

  1. 1.

    Q2 = 1, Q1 = 0, Q0 = 1, so Q2Q1Q0 = 101 = 5.

  2. 2.

    That checks out: the counter started at 0 and five edges have passed.

  3. 3.

    Notice Q0 changes every edge, Q1 every 2 edges and Q2 every 4 edges.

Common mistakes

  • Counting the starting value as one of the edges. After 6 edges from 0 the counter holds 6, not 5.

  • Forgetting to wrap. A 3-bit counter at 111 goes to 000, not to a 4-bit 1000.

  • Reading the bits in the wrong order. Q0 is the LSB, so Q2Q1Q0 = 011 is 3, not 6.

Practice Binary up counter

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Binary up counter is taught in Counters.