Johnson Counter Working, Truth Table & Calculator

Share:
Digital Electronics
Johnson Counter: How the Twisted Ring Counter Works, 4 Bit Truth Table, Timing, Decoding and Lock Out States

One inverted feedback wire turns a plain shift register into a counter with twice the states and almost free decoding. We build a 4 bit version from D flip flops, read its truth table and timing, and fix the lock out problem.

Twisted ring counter 2N states 4 bit truth table Lock out fix Free calculator

The twisted ring design feeds the inverted last output back to the first D flip flop, so N stages count through 2N states with one bit changing per clock. Below you will find the truth table, timing, decoding gates, lock out states and a working calculator.

Hello everyone, today we are going to learn how a johnson counter works, from its D flip flop circuit and truth table to decoding, lock out states and field troubleshooting.
johnson counter
Quick Answer

What is a Johnson counter and how does it work?

Johnson counter is a shift register counter in which the inverted output of the last D flip flop drives the input of the first, so N flip flops give 2N states. A 4 bit version steps 0000, 1000, 1100, 1110, 1111, 0111, 0011, 0001 and repeats. With an 8 kHz clock, each flip flop output becomes a 1 kHz square wave at 50% duty.

What Is a Johnson Counter?

A johnson counter is a synchronous shift register counter whose last flip flop feeds its inverted output back to the first flip flop. Because of this twist, N flip flops step through 2N unique states, so 4 flip flops count to 8 and 5 flip flops count to 10.

Key Facts
  • Other names: twisted ring counter, switch tail ring counter, walking ring counter.
  • Count: 2N for N flip flops (MOD 2N), against N for a plain ring counter.
  • Only one flip flop changes per clock, like a Gray code.
  • Any single state decodes with one 2 input AND gate.
  • Unused patterns: 2^N minus 2N, which can form a lock out loop.

You will meet it in decade counters, LED chasers, stepper motor drivers and clock dividers. If you are new to counters, first read our guide to ripple and synchronous counters, because this design sits in the synchronous family.

Do You Know?

A 5 stage version with 10 decoded outputs is what sits inside the popular CD4017 decade counter IC. The chip also adds anti lock gating so it cannot get trapped in an unused state.

Advertisement

How Does a Johnson Counter Work?

It shifts data one stage to the right on every clock edge while the first stage loads the complement of the last stage. Starting from all zeros, ones fill the register from the left and then zeros fill it again, giving 2N states before the pattern repeats.

Take four D flip flops named A, B, C and D, the edge triggered type from our article on flip flop types. Q of A drives D of B, Q of B drives D of C and Q of C drives D of D, exactly like a serial in shift register.

The only change is the feedback wire. A plain ring counter sends Q of D back to the input of A, while here we take the inverted output Q’ of D, and that single inversion is what doubles the count.

4 bit johnson counter circuit using four D flip flops and inverted feedback
Diagram by Instrumentation Blog showing a 4 bit Johnson counter built from four D flip flops with a common clock and the inverted QD output fed back to FF A.
1
Reset
Clear all flip flops so the register reads 0000 and QD’ is 1.
2
Fill with ones
Each clock shifts a 1 in from the left: 1000, 1100, 1110, 1111.
3
Fill with zeros
Now QD’ is 0, so zeros walk in: 0111, 0011, 0001.
4
Repeat
The next clock gives 0000 again, so 8 clocks make one cycle.
Quick Tip

Use edge triggered D flip flops, never level sensitive latches. A transparent latch lets data race through several stages in one clock, as our note on latches shows.

Johnson Counter Truth Table for 4 Bit

The 4 bit truth table has 8 rows, one per clock pulse, and every row differs from the previous one in exactly one bit. The last column lists the 2 input AND gate that decodes each state.

ClockQAQBQCQDStateDecode gate
00000S0QA’ . QD’
11000S1QA . QB’
21100S2QB . QC’
31110S3QC . QD’
41111S4QA . QD
50111S5QA’ . QB
60011S6QB’ . QC
70001S7QC’ . QD
80000S0repeats

Read it column by column and you see that QB is QA delayed by one clock, QC is QB delayed by one clock, and so on. Because only one bit moves at a time, the code is a kind of Gray code, which is why decoding is glitch free.

How Many States Does a Johnson Counter Have?

With N flip flops you get 2N valid states, while the register can hold 2^N patterns, so 2^N minus 2N patterns stay unused. For 4 flip flops that means 8 used and 8 unused.

Count used = 2N
Count unused = 2^N minus 2N
Stage output = f clk / 2N
Decoded pulse = 1 / f clk

A binary counter uses all 2^N patterns, but each output then needs a wider decoding gate, as in our 7 segment display decoder. The twisted ring needs more flip flops for the same count, but every state decodes with a 2 input gate.

johnson counter timing diagram showing clock and QA to QD waveforms for 8 states
Diagram by Instrumentation Blog showing the timing of a 4 bit twisted ring counter with an 8 kHz clock, where each output runs at 1000 Hz and each state lasts 125 microseconds.

Each output rises one clock after the stage before it and stays high for 4 clocks, a square wave with 50% duty. With an 8 kHz clock every waveform repeats at 1000 Hz.

Advertisement

How to Decode the States With 2 Input AND Gates

You decode any state of a johnson counter with one 2 input AND gate placed on the boundary between ones and zeros in the pattern. Every valid state has exactly one such boundary, so the rule works for any length.

A 4 bit design needs 8 such gates, one per state, as listed in the truth table. A binary counter of the same count needs 3 input gates and can glitch when two bits change together, which our encoder and decoder guide covers.

With only NAND or NOR gates on the board, Boolean algebra lets you rewrite each AND term. A small Karnaugh map that treats unused patterns as do not care confirms each equation.

Do You Know?

Sum the four outputs of a 4 bit version through suitably chosen resistors into one node and you get a stepped sine wave. Its frequency follows the clock, so changing the clock tunes the sine.

What Are Lock Out States in a Johnson Counter?

Lock out states are unused patterns in which the counter can start after power up or a noise spike and then keep circulating without ever reaching the valid sequence. In the 4 bit design all 8 unused patterns form one closed loop.

StepQA QB QC QDStepQA QB QC QD
10 1 0 051 0 1 1
21 0 1 060 1 0 1
31 1 0 170 0 1 0
40 1 1 081 0 0 1

After step 8 the register returns to 0100 and the loop repeats forever. You fix it with a power on reset that clears every flip flop, a self correcting gate on one D input, or both.

Normal input of FF C: DC = QB
Self correcting: DC = QB . (QA + QC)
Recovery within 5 clocks

In every valid state the new expression equals QB, so the normal count is untouched. We simulated all 16 starting patterns, and each unused one reaches the valid loop within 5 clocks.

Myth: A reset at power up means lock out never happens.
Fact: A spike on the clock or supply can still push the register into an unused pattern while running, so a self correcting gate is safer.
Myth: You need a full binary decoder to read the states.
Fact: Each state decodes with one 2 input AND gate, whatever the counter length.
Myth: Unused patterns fall back on their own.
Fact: In a plain 4 bit design all 8 unused patterns form a closed loop that never returns.

Johnson Counter Calculator: States and Output Frequency

Enter the number of flip flops and the clock frequency, and the calculator gives the MOD number, unused patterns, stage output frequency and decoded pulse timing.

States and Output Frequency Calculator
Result
MOD 8: 8 used states, 8 unused states, each stage output 1000 Hz at 50% duty, each decoded output high 125 µs in every 1000 µs

Johnson Counter Solved Example

A 4 bit johnson counter on an 8 kHz clock gives a 1000 Hz square wave at every stage output, and each decoded state stays high for 125 microseconds. The working uses the calculator default numbers.

Given: N = 4, f clk = 8000 Hz
States = 2 x 4 = 8 (MOD 8)
Unused = 16 minus 8 = 8
f out = 8000 / 8 = 1000 Hz
Decoded pulse = 1 / 8000 s = 125 µs
Decoded period = 8 x 125 µs = 1000 µs

So each decoded output is high 12.5 % of the time, one clock in eight. The clock often comes from a 555 timer or a crystal oscillator, so check the datasheet maximum clock rate at your supply voltage.

PDF
CD74HC4017 Decade Counter Datasheet
Free PDF: 5 stage Johnson counter with 10 decoded outputs, pinout, reset, clock enable and timing data
Advertisement

Difference Between Ring Counter and Johnson Counter

A ring counter returns Q of the last stage to the first and gives N states, while a johnson counter returns the inverted output and gives 2N states. So the same flip flops count twice as far.

FeatureRing counterJohnson counter
FeedbackQ of last stageInverted Q of last stage
States with N flip flopsN2N
DecodingNone, outputs are one hotOne 2 input AND gate per state
Start upMust preset a single 1Starts from 0000 after reset
Unused patterns (N = 4)128
Strengths
  • Twice the states of a ring counter
  • Glitch free decoding with 2 input gates
  • Exact 50% duty at every stage
  • Fully synchronous, no ripple delay
Limits
  • Uses only 2N of 2^N patterns
  • Can lock out without reset or correction
  • Many flip flops for long counts
  • Needs decode gates, unlike a ring counter

Johnson Counter Troubleshooting Tips

Most faults come from a dirty clock, a missing reset or a lock out state, so check them in that order. The flowchart shows the sequence we follow on the bench.

johnson counter troubleshooting flowchart for clock, reset and lock out faults
Diagram by Instrumentation Blog showing a troubleshooting flowchart for a twisted ring counter that checks clock edges, power on reset and lock out states before decoder gates.
  • Probe the clock at every flip flop pin and look for clean, single edges.
  • Confirm reset clears all stages to 0000 at power up.
  • Step the clock slowly and check that only one bit changes per pulse.
  • Tie unused CMOS inputs such as clock enable to a valid level.
  • Fit a 100 nF decoupling capacitor close to each logic IC supply pin.
Quick Tip

A slow or noisy clock edge can double clock a CMOS stage and make the count jump. Use a Schmitt trigger buffer and a short clock trace, as in our guide to noise reduction in digital ICs.

If the sequence is right but the LEDs are dim, look at output loading. Size each series resistor with our LED resistor calculator, and use a logic level shifter when a 3.3 V controller clocks a 5 V counter.

Where Is a Johnson Counter Used?

You use it wherever you need a short, glitch free sequence of evenly spaced pulses, such as decade counting, phase generation, motor stepping and LED sequencing.

Decade counters
A 5 stage design with 10 decoded outputs drives 10 lamps or relays in turn.
Stepper motor drive
Overlapping outputs give the coil phase sequence.
Multi phase clocks
Each stage gives the same square wave shifted by one clock.
Frequency division
Any stage divides the clock by 2N at exact 50% duty.

The phase sequence of a stepper motor uses the same idea. In a PLC you can copy the pattern with bit shift and rotate instructions, inverting the bit that wraps around.

Pause the video after each clock pulse and compare its pattern with our truth table. Then try a 5 stage version on paper and check that you get 10 states.

Johnson Counter FAQ

What is the difference between a ring counter and a Johnson counter?

A ring counter feeds Q of the last flip flop back to the first and gives N states, while the Johnson type feeds back the inverted output and gives 2N states.

With 4 flip flops the ring version is MOD 4 and the twisted version is MOD 8.

How many flip flops are needed for a MOD 10 Johnson counter?

You need 5 flip flops, because N stages give 2N states and 2 x 5 = 10 states in total.

Each of the 10 states then decodes with one 2 input AND gate, which is how a decade counter IC is built.

How do you calculate the output frequency of a Johnson counter?

Divide the clock frequency by 2N, where N is the number of flip flops.

For a 4 bit counter on an 8 kHz clock, 8000 / 8 gives 1000 Hz at every stage output, and each decoded state lasts 125 microseconds.

Why does my Johnson counter get stuck in a wrong sequence?

It has started in a lock out state, one of the 2^N minus 2N unused patterns that loop among themselves.

Add a power on reset that clears all stages, or a self correcting gate such as DC = QB . (QA + QC) in a 4 bit design.

Which gates are used to decode each state of a Johnson counter?

Each state needs one 2 input AND gate that watches two adjacent outputs.

For example, state S2 (1100) decodes as QB . QC’ and state S0 (0000) as QA’ . QD’, so a 4 bit counter needs 8 small gates.

Advertisement

Related Articles

External References

What We Learn Today

  • A johnson counter feeds the inverted output of its last D flip flop back to the first, so N flip flops step through 2N states.
  • Every state of the 4 bit sequence differs by one bit and decodes with a single 2 input AND gate, giving glitch free outputs.
  • Unused patterns can trap the counter in a lock out loop, so add a power on reset or a self correcting feedback gate.
Advertisement
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!
Sunayana Gadepatil, author at Instrumentation Blog
Author · instrumentationblog.in
Ms. Sunayana Gadepatil is an instrumentation professional, technical writer, and the author behind Instrumentation Blog. With a strong interest in industrial instrumentation, process measurement, and automation, she specializes in simplifying complex technical concepts into clear, practical, and easy to understand insights. Through her articles, Ms. Sunayana shares valuable knowledge on flow, pressure, level, temperature, control systems, and industrial automation for engineers, students, technicians, and industry professionals.
Technically reviewed on

Leave a Reply

Your email address will not be published. Required fields are marked *

Support free learning

Help keep every guide, calculator and tool 100% free

Hosting, software and hours of research go into every article. Even a small contribution helps us publish more in-depth guides for students, technicians and engineers.

  • No paywalls
  • No sign up
  • Free for everyone