Skip to content
DLVSDigital Logic Visualizing System

Logic Lab

Counter Design

Design a counter from a state diagram: state table, excitation table, flip-flop input equations and a self-start check, for D, T, J-K or S-R flip-flops.

Flip-flopsType

0 → 1 → 2 → 4 → 6 → 0

States in the cycle5
Flip-flops3 × J-K
Unused states3

1. State diagram

000001010100110
Q2Q1Q0 = 000
Jump to

2. State table with flip-flop excitation

PresentNextJ2K2J1K1J0K0
0000010X0X1X
0010100X1XX1
0101001XX10X
100110X01X0X
110000X1X10X

For every flip-flop the excitation table gives the inputs that produce its change from the present bit to the next bit: 0→0: J=0 K=X; 0→1: J=1 K=X; 1→0: J=X K=1; 1→1: J=X K=0.

3. Flip-flop input equations (simplified)

Σm(2) + d(4, 6, 3, 5, 7)

J2 = Q1

Σm(6) + d(0, 1, 2, 3, 5, 7)

K2 = Q1

Σm(1, 4) + d(2, 6, 3, 5, 7)

J1 = Q0 + Q2

Σm(2, 6) + d(0, 1, 4, 3, 5, 7)

K1 = 1

Σm(0) + d(1, 3, 5, 7)

J0 = Q2′·Q1′

Σm(1) + d(0, 2, 4, 6, 3, 5, 7)

K0 = 1

Each equation is simplified with the Karnaugh-map (Quine–McCluskey) engine. The states that are not in the cycle, and the X entries, are don’t cares, which is why the equations are short.

4. Unused states

  • 011 → 100 back in the cycle after 1 pulse
  • 101 → 110 back in the cycle after 1 pulse
  • 111 → 000 back in the cycle after 1 pulse

✓ Self-starting: whatever state the power-up leaves it in, the counter reaches the cycle.

5. Input logic from gates

0Q20Q10Q0J1=0J0=1

The gates turn the present state (tap a Q box to change it) into the flip-flop inputs. An equation that is only a constant or a plain variable is a wire and is not drawn.

Design procedure: draw the state diagram, write the state table, use the excitation table of the chosen flip-flop to fill in the inputs, simplify with don’t cares for unused states, then draw the circuit. Switch the flip-flop type above to see how the equations change for the same sequence.