Tuesday, February 17, 2009

You Can Count on It

A Look at Counters and Timers
Contributed editorial appearing in
Scientific Computing & Instrumentation 18:9, August 2001, pg. 16.

The 1988 movie Beetlejuice injected Harry Belafonte’s 1957 song “Day-O“, a.k.a. “The Banana Boat Song” into modern pop culture. I am haunted by the lyrics “Come, Mr. Tally Mon, tally me banana” each time I discuss my son’s kindergarten math program. As I reflect on the importance and shear necessity of mathematics in our profession, it is refreshing to look back to the first yellow brick in the road eventually leading to the Oz of science and engineering. Although counting may often be looked at as child’s play, counting web traffic, ingredients, contents, pollution, radiation levels, dosing, and votes are of high value to the parties involved.

The word “tally” was coined in the 15th century from the Latin for “twig.” Cutting notches into a twig or similar object could keep a record of “how many,” and is a common literary device used by authors who strand their protagonists in remote locations. Although our Arabic decimal number system is based on the ten fingers of both hands, the tally mark system reflects the five fingers of one hand. Each count is represented by a single cut or line until five is reached, at which point the previous four marks are cut through diagonally with a fifth line, thereby creating the tally representation of five. Additional counts are “carried over” to another marking location and the process continues in the same fashion. The count total is obtained by “skip-counting” the completed marks by five and adding any final partial tally mark.

The tally mark system taught to the kindergartners is the basis of operation for the mechanical odometer of an automobile. The one’s position of the odometer is geared for one full - rotation every 10 miles traveled. At the completion of one rotation, a tooth in the one’s position advances the ten’s position one-tenth of a turn, thereby carrying over its value of ten to the ten’s position before rolling over to zero. The ten’s position is geared to the one-hundred’s position, and so on. Older odometers capable of displaying a maximum of 99,999 miles, rollover to a display of 00,000 and the carry over to the one-hundred thousand position is lost.

The electronic counter was made possible by the development of the Bistable Multivibrator (BMV) by W. H. Eccles and F. W Jordan in 1919. In the 1950s, solid-state transistors supplanted the original vacuum tubes. Today this circuit is better known as a “flip-flop” (FF). The FF circuit is capable of storing or “remembering” a voltage value associated with a binary 0 or 1 and is memorialized as the earliest example of computer memory. A FF circuit has the ability to accept a signal to be stored (the data), a signal for clearing the value (the reset), and a signal for controlling when the data can be stored or reset (the clock). Using a small number of logic circuits, a FF - based circuit can be designed to flip back and forth between 1 and 0 each time a clock pulse is received. This 1- bit counter is capable of counting the number of clock pulses it receives up to a total of 1, as each time it rolls- over to 0, the carry over is lost. A 2 - bit counter is constructed by connecting the current state of the first FF to the clock input of a second FF. In this fashion, the carry over from the first FF is stored in the second FF, resulting in a maximum count of 3. In order to count a large number of events, additional FFs are connected in succession to obtain an “n-bit” counter. This arrangement is asynchronous, as time is required for each FF to change its state before the successive FF can be set. High-speed synchronous counters are designed by connecting the source input signal to the clock input of every FF in the circuit. To prevent the entire circuit from oscillating between all ones and all zeros, the data lines of the FFs are connected to the values of the upstream FFs. For instance, although the fourth FF in a four-bit counter receives the same synchronous clock signal to flip, it stores a value of 0 until all the values of bits one, two, and three, are 1, signaling the need for a carry over from the first three bits.

If the clock signal is configured to deliver one pulse per second, the FF counter can be configured as a timer. Using additional logic components, the timer can be made to count up or down. The counter can be configured as a frequency counter by connecting the one-second duration clock pulse to the enable line so that the number of pulses received by the counter in one second can be acquired.
blog comments powered by Disqus