Java Circuit Simulation Workaround ▾

Due to recent changes by Oracle, java applets have become difficult to run in the browser. To mitigate the troubles, Oracle has provided the following websites to help users troubleshoot: http://java.com/en/download/help/enable_browser.xml and https://www.java.com/en/download/mac_download.jsp

Even after following the above instructions, loading applets may still show warning concerning “unsigned application” and “unknown publisher”. For Teahlab in particular, these warnings are due to the fact that we have opted not to pay a third party such as Verisign to sign our applets. Any warning that comes up when you try to run our applets should emphasize that our applets will always run with “limited access”, which is Oracle’s way of letting you know that teahlab doesn’t do anything on your computer except running the circuits you see: in other words, our applets are safe to run.

Sincerely,

The Teahlab Team

THE JOHNSON COUNTER
by Isai Damier

The interactive Johnson Counter digital logic circuit, with Boolean function and truth table.

Just as people use watches and calendars to keep track of important events in their lives, digital applications use counters to keep track of important processes. When you go do your laundry, for instance, the computer in your washing machine uses counters to track the different cleaning cycles that the machine goes through.

Counters come in all shapes and forms; similarly to how cars come in all shapes and forms.

TRUTH TABLE
FF Output Decoder Count
A B C E AND
0 0 0 0 A’E’ G1
1 0 0 0 AB’ G2
1 1 0 0 BC’ G3
1 1 1 0 CE’ G4
1 1 1 1 AE G5
0 1 1 1 A’B G6
0 0 1 1 B’C G7
0 0 0 1 C’E G8

The Johnson counter in the main interactive circuit is just one type of counter. It has four D-flipflops, and it counts from G1 to G8. This mathematical relationship, where 2* flipflops = count, is a special property of the Johnson counter. To count from one to ten we would need five flipflops; from one to thirty we would need fifteen flipflops. In addition to the four D-flipflops, the circuit has eight two-input AND gates. This too is a peculiarity of the Johnson counter: the circuit uses one two-input AND gate per count, so that the number of AND gates in the circuit is twice the number of D-flipflops.


From another perspective, the Johnson counter is the combination of a decoder and a ring counter, a switch-tail ring counter to be exact. From that view, our counter is a four bit switch-tail ring counter connected to a four-to-eight bit decoder.

Figure 1 below shows the ring counter that serves as the backbone of the Johnson counter. Figure 1 is interactive, so you can play with it. The circuit is called a ring counter because as the clock cycles the circuit moves (or stretches) a signal through a circular chain of flipflops. The modifier “switch-tail” is to emphasize that the source of the signal is the negative tail of the circuit; in other words, the complemented output (E’) of the last flipflop in the chain feeds the input of the first flipflop in the chain. Hence, the last flipflop supplies the source signal (E’) that is propagated through the flipflop chain.



An important detail about the Johnson counter is that the circuit must be initialized correctly in order for it to generate the desired counting sequence. We incorporate this idiosyncrasy in the interactive circuits by requiring that you initialize the circuits by first clicking on an empty area of the board before counting. If you don’t, the counting sequence you get will be amiss so that you will have to refresh the browser to do it correctly.

When the Johnson counter is first initialized, the only asserted piece of wire is the one connecting the complemented output of the last flipflop (E’) to the input of the first flipflop in the counter. Then as the clock cycles, the signal originating from E’ propagates though all the flipflops until it reaches the output E. Once the propagating signal reaches E, the signal at E’ changes level, so that at the next clock cycle the new signal emanating from E’ will start making its way through the counter. Play with the circuit in Figure 1 for an illustration.

The interactive 4 - Stage Switch-Tail Ring Counter digital logic circuit, with Boolean function and truth table.
Figure 1: — Four-Stage Switch-Tail Ring Counter

Decoding the Johnson Counter

The procedure that we use to decode the timing signals of the Johnson counter is easy to follow (see the truth table). To get the first timing signal (state = 0000), we take the complemented output of the first flipflop (A’) and the complemented output of the last flipflop (E’) in the chain and combine them into an AND gate. To get the middle timing signal (state = 1111), we combine the normal outputs of the first flipflop (A) and the last flipflop (E) into an AND gate.

To get the signals of the states that fall between 0000 and 1111: starting with the first flipflop in the counter, we simply combine with an AND gate the normal output of a flipflop to the complemented output of the flipflop that follows it -- until we reach the last flipflop in the chain. To illustrate, the signals between 0000 and 1111 are AB’, BC’, and CE’. We stop after reaching E’ because it is from the last flipflop in the chain.

To get the signals that come after 1111: starting with the first flipflop, we combine with an AND gate the complemented output of one flipflop with the normal output of the flipflop that follows it. And, of course, we do this until the last flipflop is reached. Again to illustrate, the signals that follow 1111 are A’B, B’C, and C’E. Here again we stop after E because it is from the last flipflop in the chain.

As our decoding procedure just explained how we decoded the timing signals of our four-bit counter, the procedure can be used to decode a Johnson counter of any arbitrary length. First, you will need to chain together as many D-flipflops as you need. Then you just follow our decoding procedure.