
In the world of digital electronics, creating precise timing and control sequences is fundamental. While simple counters exist, they often suffer from inefficiency or the risk of "glitches"—brief, erroneous signals caused by multiple bits changing simultaneously. This article explores an elegant solution: the twisted-ring counter, more commonly known as the Johnson counter. This ingenious device uses a simple modification to a standard shift register to generate remarkably robust and useful sequences. This article delves into the inner workings of this counter, starting with its core principles and then exploring its wide-ranging applications. The first section, "Principles and Mechanisms," will deconstruct how the counter's signature "twist" creates a unique, glitch-free state sequence and discuss its inherent properties and limitations. Following this, "Applications and Interdisciplinary Connections" will demonstrate how this abstract concept becomes a powerful tool in real-world systems, from controlling motors to synthesizing complex frequencies.
To truly understand a machine, one must look under the hood. The Johnson counter, for all its utility, is built upon a foundation of breathtaking simplicity. Its magic arises not from complex components, but from a single, elegant "twist" on a more basic idea. Let's begin our journey there, with the simplest possible loop, and see how this one small change creates a cascade of profound and useful consequences.
Imagine a line of people, say four of them, arranged in a circle. Each person can hold up either a black card or a white card. At the sound of a bell, everyone passes their card to the person on their right. This is the essence of a shift register. But what does the first person in line do? They receive a card from the last person. This closed loop, where the output of the final stage is connected directly to the input of the first, is called a ring counter.
If we start this game with one person holding a white card and the other three holding black cards—a state we might write as 1000—what happens? On the first bell, the pattern becomes 0100. On the next, 0010. Then 0001, and on the fourth bell, it's back to 1000. The single "1" simply circulates around the ring.
For an -bit ring counter, this cycle will always have exactly unique states. While simple, it's not very efficient. A 4-bit register can represent different patterns, yet our simple ring counter only ever visits four of them. Nature, it seems, has more economical tricks up her sleeve.
Now, let's introduce the twist. Let's change just one rule of the game. When the last person passes their card back to the first, they must flip it over. A white card becomes black, and a black one becomes white. In the world of digital logic, this "flipping" is accomplished with a simple inverter, a NOT gate.
This single modification—taking the inverted output of the last flip-flop and feeding it back to the first—is all that separates a plain ring counter from a Johnson counter, or as it's aptly named, a twisted-ring counter. It's a beautifully simple change, but this twist is the source of all the counter's remarkable properties.
Let's watch this new game unfold. We'll start our 4-bit counter with all zeros: 0000.
0. The twist flips it to a 1, which is fed into the first position. The other bits shift right. The new state is 1000.0. It's flipped to 1 and sent to the front. The state becomes 1100.1110, and then 1111. The register is now full.1. The twist flips it to a 0. This 0 enters at the front. The state becomes 0111.0011, then 0001, and finally, on the eighth clock pulse, we return to 0000.The cycle is complete. Notice what happened: our 4-bit counter produced 8 unique states. This is the general rule: an -bit Johnson counter has a modulus (a cycle length) of states. This simple twist has doubled the number of states we can access in a single cycle.
This also means that of the total possible states, the Johnson counter leaves many of them unused. A 5-bit counter uses states, leaving states as "invalid" or "unused" in its normal operating cycle. For a 3-bit counter, the six valid states are {000, 100, 110, 111, 011, 001}, leaving the states 010 and 101 in the cold. This orderly progression of states, filling with ones and then with zeros, produces a pattern that, if converted to an analog voltage, would create a smooth, stepped approximation of a sine wave with a well-defined average value.
There is a deeper beauty in the sequence 0000 1000 1100 1110... Look closely. To get from any state to the next, exactly one bit changes. This is a profound property, one that designers of digital systems cherish.
Why? Imagine you want to build a circuit that lights up an LED only when a counter reaches a specific state, say 011. If you use a standard binary counter, the next state after 011 is 100. At that clock edge, all three bits attempt to flip simultaneously. But in the real world, nothing is perfectly simultaneous. Tiny, unavoidable differences in wire lengths and gate speeds mean the changes arrive at your detection circuit at slightly different times. For a nanosecond, the circuit might see a false state, causing a brief, unwanted flicker in your LED—a glitch. It's like trying to read a sign where all the letters are changing at once; you're bound to misread it for a split second.
Now consider the Johnson counter. For a 3-bit version, the state after 011 is 111. Only a single bit changes. Your detection circuit sees one clean, unambiguous transition. There is no race between signals, no opportunity for a glitch to form. The output is clean and reliable. This inherent orderliness, where states are always "adjacent" to each other, makes the Johnson counter an exceptionally robust and elegant tool for building sequential controllers.
The orderly dance of the bits provides another gift. If we look not at the counter's state as a whole, but at the waveform of each individual output bit over a full cycle, we find another remarkable pattern. For a 2-bit counter, the cycle is (0,0) (1,0) (1,1) (0,1). The waveforms for the two outputs, and , are:
0, 1, 1, 00, 0, 1, 1Each output is a perfect square wave with a 50% duty cycle and a frequency one-quarter that of the master clock. More importantly, they are perfectly phase-shifted. The period is 4 clock cycles, and 's rising edge happens one cycle after 's. This corresponds to a phase lag of .
This makes the Johnson counter a wonderfully simple and effective way to generate multiphase clock signals. In digital communications, for instance, systems often require quadrature signals (I and Q), which are two signals of the same frequency but 90 degrees out of phase. A 2-bit Johnson counter, with a couple of flip-flops and an inverter, produces these signals almost for free. It's a miniature digital symphony, with each part playing the same tune, just starting at a different, precisely controlled time.
We've celebrated the Johnson counter's order, but its tidy main sequence has a dark side: the vast territory of unused states. What happens if a stray bit of noise—a power surge or a cosmic ray—jolts the counter from its proper path into one of these invalid states?
Let's return to our 4-bit counter and its 8 unused states. Suppose it's forced into the state 0101. On the next clock pulse, the twisted feedback rule still applies. The last bit (1) is inverted to 0, which becomes the new first bit, and the rest shift. The next state is 0010. If you continue to trace the sequence, you'll discover something alarming: the counter will never return to the main 0000... sequence. It has become trapped in a separate, parallel cycle consisting entirely of other unused states.
This is because the state transition rule is a perfect one-to-one mapping; every state has a unique predecessor and a unique successor. The entire space of states is fractured into multiple, disjoint cycles. For an 8-bit counter, the 256 possible states are partitioned into 16 completely separate cycles, each 16 states long.
This means the standard Johnson counter is not self-correcting. Once it's knocked off its path, it's lost in a parallel universe. This is a critical consideration for any real-world design. Engineers must add extra logic to either guarantee a correct starting state on power-up or to actively detect an invalid state and force a reset. The simple twist that created such beautiful order also created hidden traps, a reminder that even in the most elegant systems, one must always be prepared for chaos.
Now that we have taken apart the twisted-ring counter and understood the beautiful, ghost-like procession of ones and zeros that dances around its circular stage, we might be tempted to put it back in the box, labeling it a "curiosity." But to do so would be a great mistake! The true magic of any scientific principle is not in its isolated elegance, but in what it allows us to do. The Johnson counter, with its unique and deceptively simple properties, is not merely a curiosity; it is a workhorse, a versatile tool that appears in some of the most unexpected and ingenious corners of technology. Let's explore this landscape and see where our counter's peculiar rhythm takes us.
At its most fundamental level, a clock in a digital system is a heartbeat. But often, a single heartbeat isn't enough. Different parts of a system may need to operate at different tempos. How do we derive a slower, steady beat from a faster master clock? The Johnson counter offers a wonderfully simple solution. Because it takes steps to complete a full cycle, the output of any single flip-flop, say , will go high and then low exactly once during that cycle. This means the signal at any output has a frequency of exactly . If you have a system clock running at 100 kHz and you need a precise 12.5 kHz signal to run a peripheral, a simple 4-bit Johnson counter provides it directly, with no extra components needed. It’s a frequency divider of remarkable purity.
But this is just the beginning. The counter doesn't just provide a slower clock; it provides a choreographed sequence of states. We can use simple logic gates to act as "spotlights," picking out moments in the cycle to create custom waveforms. Imagine you need a perfectly symmetrical square wave—one that is high for exactly half its period and low for the other half. By observing the states of a 4-bit Johnson counter, we find that a pattern like 11001100... achieves this. A clever engineer would notice that this pattern can be generated simply by connecting two specific outputs of the counter, say and , to an XNOR gate. The gate's output becomes our desired signal. This is the art of digital design: seeing a complex waveform not as something to be built from scratch, but as a hidden pattern waiting to be decoded from a simpler, underlying process.
The inherent symmetry of the Johnson sequence makes such decoding astonishingly efficient. Suppose you want a signal that is active only during the first half of the counter's cycle. One might imagine a complex logic circuit is needed to identify all those states. But a closer look at the sequence reveals a secret: for an N-bit counter, the most significant bit, , is '1' for the first N states of the cycle (as the register fills with ones) and '0' for the second N states. Therefore, a signal that is active high during this first half can be taken directly from the output, requiring no additional logic gates. This is the kind of profound simplicity that scientists and engineers live for—where a deep understanding of a system allows you to achieve a powerful result with minimal effort.
The true power of the Johnson counter is revealed when we see it not just as a timekeeper, but as a conductor. Its predictable, one-step-at-a-time progression is perfect for orchestrating a sequence of events. There is no better real-world example than in the control of a modern brushless DC (BLDC) motor—the kind found in everything from computer fans and drones to electric vehicles.
A three-phase BLDC motor is spun by energizing its electromagnetic coils in a specific six-step sequence. Getting this sequence wrong can cause the motor to jerk, stall, or run inefficiently. What we need is a reliable, glitch-free state generator that produces exactly six unique states. Enter the 3-bit Johnson counter. It naturally produces a cycle of states. Each of these states—000, 100, 110, 111, 011, 001—can be directly mapped to one of the six steps in the motor's commutation sequence. The counter steps through its cycle, and the motor follows in perfect, smooth synchronization. The abstract dance of bits inside the chip becomes the physical reality of smooth, controlled motion.
This concept extends far beyond motors. The Johnson counter can serve as the "brain" for any process that requires a fixed sequence of operations. Imagine a more complex digital component, like a universal shift register, which can perform several different actions: hold its data, shift bits left, shift bits right, or load new data from an external source. How does it know what to do at any given moment? We can use the outputs of a Johnson counter as the "mode select" inputs for the register. As the counter clicks through its states—say, 00, 01, 10, 11 on its first two bits—it could command the register to first Hold, then Shift Right, then Shift Left, and finally Parallel Load. The Johnson counter becomes a simple, reliable sequencer, ensuring a complex chain of events happens in precisely the right order.
So far, we have treated the Johnson counter as a device with a fixed, unchangeable sequence. But what if we need a different rhythm? What if the standard steps aren't quite right for our application? Here, we discover another layer of beauty: the counter's structure is not a prison but a flexible blueprint. By adding a little bit of combinational logic, we can modify its behavior in profound ways.
Suppose we want a counter that skips certain states. For example, we could take a 3-bit Johnson counter and modify it to avoid any state where the first and last bits are the same. This would remove 000 and 111 from its natural 6-state cycle, creating a custom 4-state cycle. By analyzing the desired transitions and using standard logic design techniques, we can derive a new equation for the input of the first flip-flop, altering the feedback loop to enforce our new rules.
This idea can be taken even further to create programmable devices. Imagine we want a frequency divider that can be changed on the fly—sometimes we need to divide by 2, sometimes by 4, 6, or 8. We can start with a 4-bit Johnson counter (which naturally divides by 8) and add a synchronous RESET input. Then, we build a small logic circuit that watches the counter's state. If we want a modulus-6 division, this circuit is programmed to assert the RESET signal as soon as the counter reaches its 6th state. This forces the counter back to the beginning, shortening its natural cycle from 8 steps to 6. By using a few external control pins to tell the logic circuit which state to watch for, we can create a variable-modulus counter capable of producing multiple different frequencies from a single master clock. The rigid sequence has become a programmable instrument.
The simple elegance of the Johnson counter allows it to punch far above its weight, finding applications in highly advanced and interdisciplinary fields.
One such field is Built-In Self-Test (BIST) for complex integrated circuits. Testing a modern microprocessor with its billions of transistors is a monumental task. One strategy is to have the chip test itself by generating its own test patterns. But there's a catch: rapidly changing test patterns can cause the circuit to consume a huge amount of power, potentially damaging it. Here, the Johnson counter's key property—that only one bit changes at each clock tick—is a massive advantage. Using a Johnson counter as a Test Pattern Generator (TPG) ensures minimal switching activity, leading to a low-power test. The sequence itself might be too predictable to be a good test, but its output can be passed through a simple "scrambler" circuit (e.g., a series of XOR gates) to create patterns that are both pseudo-random and have low switching energy. It's a beautiful marriage of simplicity and complexity.
Perhaps the most mind-bending application is in digital frequency synthesis. We've seen that the counter can divide a frequency. But can it create entirely new ones through synthesis? Consider a system with our 4-bit Johnson counter and, running alongside it, a standard 8-bit binary counter. This binary counter produces a rich set of 8 different square waves, each at a frequency half of the previous one. Now, we use the Johnson counter not as a signal source, but as a high-speed selector switch (a multiplexer). As the Johnson counter cycles through its 8 states, it tells the multiplexer which of the 8 signals from the binary counter to output at that instant. By wiring the connections in a clever way, we can stitch together small segments from different frequencies to synthesize a completely new and complex waveform. In one clock cycle, the output might be from a slow signal; in the next, from a fast one. The Johnson counter, our simple ring of flip-flops, becomes the maestro of a symphony of frequencies, enabling the creation of signals that would otherwise be impossible to generate.
From the steady pulse of a motor to the intricate choreography of a frequency synthesizer, the twisted-ring counter is a testament to a fundamental principle in science and engineering: that from the simplest rules, the most profound and useful behaviors can emerge. Its defining characteristic—a single, inverted feedback loop—gives rise to a cascade of properties that make it an indispensable tool, illustrating the deep and beautiful unity between abstract logic and the physical world.