Cost: $0-100
About These Ratings
Difficulty: Intermediate; some special skills needed. Danger 1: (No Hazards) Utility:

------------------------

Microelectronic Flip-Flops and NAND Gates Add Up to a High-Speed Counter

---------------------

by C. L. Stong
May, 1973

---------------------

ESSENTIAL elements of the pinpoint landings on the moon and of other feats during recent years are a pair of electronic gadgets known as the flip-flop and the NAND gate. Flip-flops, which can count events and remember the count, and NAND gates, which can make decisions and control the action of flip-flops, are basic building blocks of digital computers. Recently a number of amateurs have undertaken to convert these devices into such things as intrusion alarms, precision clocks and detectors for making audible the supersonic cries of bats.

The flip-flop is analogous to a light switch of the pull-chain type. Successive pulls on the chain alternately turn the lamp on and off. Similarly, when pulses of voltage are applied sequentially to the single input terminal of a flip-flop, they cause pulses of voltage to appear alternately at each of two output terminals.


Inputs and outputs of NAND gate

NAND gates have two or more input terminals but only one output terminal. When the voltage falls to zero at any or all of the input terminals of the NAND gate, the voltage rises to a maximum at its output terminal. Conversely, the application of a voltage to all input terminals causes the voltage to fall to zero at the output terminal [see illustration at left].

Physically both devices consist of microscopic deposits of metallic films and chemical compounds on minute "chips" of silicon that function as electrical networks of transistors and resistors. Usually several chips are enclosed by a terminal-studded wafer of plastic or ceramic. Circuit designers tend to ignore the internal details of the structures. They combine flip-flops and NAND gates with accessories to form computer systems by following a set of rules that amateurs can easily learn. An introductory project that involves the design of a high-speed counter for use in experiments of many kinds is described by Barry Shackleford, an electronics engineer with the Hughes Aircraft Company. Shackleford writes:

"All electronic digital computers process information in the form of binary digits, a system of numbers that is familiar to all grade-school children who have completed two years of the 'new math.' The binary system is similar to the decimal system but differs in two details. First, in the decimal system the positions for numerals, from right to left, represent increasing powers of 10. In the binary system the corresponding positions represent increasing powers of 2. Second, the decimal system requires 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The binary system requires only two: O and 1. In the decimal system the quantity twenty-five is written 25, which reading from right to left represents the sum of 5 X 10 plus 2 X 10. The same quantity is written in the binary system as 11001. Again, reading from right to left, the binary number represents the sum of 1 X 2 plus O X 2 plus 0 X 2 plus 1 X 2 plus 1 X 2, or 1 + 0 + 0 + 8 + 16=25.

"Numbers can be symbolized by electrical switches. For example, a rotary switch that includes a wiper arm for making contact with 10 different terminals can be used to express each numeral of the decimal system. Large numbers can be expressed by providing a similar rotary switch for each power of 10. Such switches are costly and difficult to maintain. Binary numbers can be expressed by a simple switch that merely closes and opens a circuit. The closed position can symbolize a 1 and the open position a 0. Electronic switches of this kind, which can be made cheaply, have no moving parts.


A dual J-K flip-flop

"A switch of particular interest that is found in all modern computers is known as the J-K flip-flop. It is available commercially in the form of a rectangular wafer of plastic about three-quarters of an inch long, a quarter of an inch wide and an eighth of an inch thick [see illustrations at right and lower left]. One end of the wafer is marked by a small notch.


Terminals of J-K flip-flop

"In one popular form of the device, which is known as a 'dual-in-line package,' terminals that extend from the long edges of the wafer are bent at right angles toward one side (the bottom) to form evenly spaced rows. The terminals are identified by a standard numbering scheme that applies to all similarly packaged devices. Terminal 1 is located adjacent to the notch at the left (as the unit is viewed from the top). The remaining terminals are numbered sequentially down the left side and up the right side.

"Power in the form of direct current at a potential of five volts is applied to one terminal of the package, which is designated Vcc. The device is connected to ground by another terminal, designated Gnd. In addition each flip-flop has a minimum of six operating terminals. One of the six, which is conventionally identified as the clock terminal, serves as the input. (The term 'clock' derives from the frequent use of flip-flops to divide sequences of precisely timed voltage pulses.) Two of the five remaining terminals connect to the J and K circuits of the flip-flop. These are control terminals. They can be used to inhibit the operation of the device.

"Since a flip-flop switches between two possible states, an output voltage appears at one or the other of two output terminals but never at both simultaneously when the device is supplied with power. Thereafter the output voltage shifts alternately from one output terminal to the other as pulses of voltage are applied sequentially to the input terminal. Usually an output voltage is taken only from the terminal designated Q. The second output terminal, which is designated (meaning 'not-Q'), can be used for control functions. The remaining terminal is designated 'reset.'

"The device operates normally when potential is maintained on the reset terminal. When the voltage on the reset terminal falls to zero, potential on the Q output either remains at zero or automatically returns to zero. Symbolically the presence of a potential in excess of two volts on the Q output terminal can be interpreted as the binary digit 1 or alternatively as the logical 1: 'yes' or 'true.' Conversely, a potential of less than two volts symbolizes the binary 0 or the logical 0: 'no' or 'false.' In apparatus of conventional design potentials that are referred to as 1 and 0 actually approach five volts and zero volts respectively.


Flip-flop sequence for counting 16 events

"An apparatus for counting up to 16 events can be assembled by interconnecting four flip-flops [see illustration at right]. (The diagram illustrating the connections has been simplified by omitting the Vcc, J, K and 'reset' terminals.) It is assumed that the Q outputs of all flip-flops are initially at zero potential.

"The push button is operated to demonstrate the counting action of the circuit. As the contacts close, a potential of five volts is applied almost instantly to the input of flip-flop A of the series. The rise in potential from zero to five volts causes no apparent change in the state of the device.

"When the push button is released, the potential at the input terminal falls abruptly. As the potential approaches zero the flip-flop changes state. The potential at output terminal Q rises to five volts, which symbolizes a binary 1, and the potential at falls to zero. The potential at Q is applied to the input of flip-flop B.

"Note that the input voltage rose sharply, remained constant for a time and then returned quickly to zero. A graph made by plotting potential against time would have the form of a rectangle. An electrical signal of this form is known as a square wave. Note also that flip-flop A changed state in response to the trailing edge of the pulse.

"Flip-flops are designed to ignore pulses that are not almost perfectly rectangular. To trigger a change in state the signal voltage must drop from maximum to near zero in less than a millionth of a second. This characteristic enables the devices to distinguish between a true signal and the voltage pulses of random shape known as noise. Flip-flops will not in fact respond reliably to pulses that are generated by an ordinary push button. An appropriate switch for generating square electrical pulses will be described below.

"At the end of the first pulse the voltage states of the four Q outputs can be represented by a sequence of four corresponding binary digits: 0001 (reading left to right). Another pulse is now applied to the input. Its trailing edge causes flip-flop A to change state. The potential falls to zero at Q and also at the input of flip-flop B. Thus the sequence of two square pulses applied to the input of flip-flop A generates a single pulse at the input of flip-flop B. Flip-flop B changes state. The state of the four Q outputs is now represented by the binary number 0010. Translated into decimal notation the binary number is equal to 0 X 2 + 0 X 2 + 1 X 2 + 0 x 2, or 2.

"The trailing edge of the next pulse, the third in the series, causes flip-flop A to change state, resulting in the expression at the Q outputs of the binary number 0011, which is equivalent to decimal 3. The fourth pulse induces the output state 0100, equivalent to decimal 4, and so on. After the 15th pulse the voltage appears on all four Q outputs: 1111. The trailing edge of the 16th pulse returns all outputs to zero.


Voltage staes at outputs of four-stage flip-flop counters

"The state of all Q outputs after each pulse in a sequence of 16 pulses is depicted by the accompanying set of graphs [illustration at left], which were prepared by plotting voltage against time. The maximum quantity that can be expressed by a series of flip-flops is equal to 2 - 1, in which n is the number of flip-flops. Thus a string of four flip-flops can register 24 - 1 = 15, or 1111 in binary.

"A series of flip-flops can also be used for dividing numbers by any selected power of 2. For example, a string of three flip-flops can divide a number by 8. Each sequence of eight pulses applied to the input of the string generates one pulse at the output of Q.

"Division by numbers other than the powers of two can be accomplished by resetting all flip-flops to zero at the end of any desired count. The scheme is made possible automatically by the 'reset' feature of the J-K flip-flop and the use of a NAND gate. Since flip-flops reset automatically to the Q = 0 state if the potential on the reset terminal is reduced below two volts, and the voltage falls to zero at the output terminal of a NAND, gate when a voltage is applied to all its input terminals,division by any number can be performed by de-energizing the 'reset' terminals of the flip-flopthrough an appropriately connected NAND gate.


Divide-by-9 counter

"The scheme is illustrated by the accompanying circuit [illustration, right], which has been designed to divide by 9. The output terminal of the NAND gate sends a voltage to the 'reset' terminals of all the flip-flops until a potential appears simultaneously at output terminals Q and Q, which is the state described by the binary number 1001. Hence at the count of nine the output potential of the NAND gate and the 'reset' terminal falls to zero, thus resetting all Q outputs to logical 0 in preparation for the next series of nine incoming pulses.

"Circuits for division by any number that is not a power of 2 can be devised by following a few simple rules. Express the divisor as a decimal number. Find the next higher power of 2. Diminish the exponent by 1 to find the required number of flip-flops. For example, if the divisor is 25, the next higher power of 2 is 32. Since 32 is 2, the required number of flip-flops is four.

"Connect the Q output of each flip-flop to the input of the next flip-flop in the sequence. Connect the 'reset' terminals of all flip-flops to the output of a NAND gate. Express the divisor as a binary number. Connect the input terminals of the NAND gate to the Q outputs of all flip-flops that are at the state of logical in the binary number that expressed the divisor. For example, the three input terminals of a NAND gate connected the Q Q and Q of a series of five flip-flop would cause the apparatus to recycle o the count of 25 (11001).

"Experimental counters of this general kind can be assembled with flip-flops of the 7473 J-K master-slave type. These units, like all integrated-circuit devices in the 7400 series, are commercially available in the form of dual-in-line packages. The 7473 package contain two separate flip-flops and costs $1.68 in lots of from one to nine units. The Type 7400 package contains four separate NAND gates, each with two input terminals, and costs 96 cents in lots o from one to nine. A gate with an odd number of input terminals can be made by connecting the unused input terminals to a potential of five volts through a resistor of 1,000 ohms.

"Combinations of flip-flops and NAND gates interconnected as described are known as ripple counters. The reason is that input pulses 'ripple' through the string of flip-flops sequentially, each device triggering the next one in the series Because of variables in manufacturing techniques the devices operate at slightly different speeds. For this reason the maximum rate at which a ripple counter can operate is determined by the performance of the slowest device in the circuit.

"Ripple counters assembled from devices in the 7400 series can divide reliably up to about a million pulses per second. To divide at higher rates the de vices are interconnected to operate as synchronous counter. In this scheme in coming pulses are applied simultaneously to the input terminals of all the flip- flops. Depending on the state of the count, certain of the flip-flops are disabled by applying a voltage from selected terminals to either or both of the J-K terminals.

"Synchronous counters can reliably divide more than 20 million pulses per second. The circuit is somewhat tedious to design. Synchronous counters are available commercially as self-contained devices in the 7400 series. Here are some examples of their use.


Latch circuit for clock pulses

"A convenient source of pulses for testing counters can be generated with an inexpensive apparatus that includes a pair of resistors, a pair of NAND gates and a single-pole, double-throw mechanical switch in the form of a push button [see illustration at left]. Mechanical switches do not generate single pulses reliably because their contact springs tend to vibrate and thus to create unwanted pulses. The suggested circuit is known as a latch; indeed, it is analogous to the latch on a screen door. When the door is slammed shut, the latch closes and prevents the door from bouncing open. Similarly, when the push button of the suggested circuit is pushed, the voltage normally present on is transferred to the output, Q, and it remains constant on Q even if the contacts of the push button thereafter open and close repeatedly. When the button is released, the output voltage falls to zero in less than 20 billionths of a second and remains at zero, thereby forming a single pulse with an abrupt trailing edge to which J-K flip-flops are sensitive by design.

"A counter for generating time signals that appear at a desired rate and persist through a desired interval has many experimental applications. For example, voltage pulses that mark equal intervals of time can fix the speed of a synchronous motor for driving such a mechanism as a clock or a telescope and actuating a pen motor that inscribes time pips on a seismogram, can establish a calibrated time base for an oscilloscope and can generate an audio signal for timing a lunar occultation, processes in the photographic darkroom and so on. A pair of counters that have been particularly useful in my own experimentation illustrate the functions of several integrated-circuit devices and some of the techniques that have been developed for assembling the devices into useful instruments.


Circuitry of voltage clipper

"Particularly useful is a counter that divides the 60-hertz frequency of a power line into periods of .1 second, one second, 10 seconds and one minute. To operate the counter the undulating pulses of voltage from the power line are reshaped into rectangular pulses by two devices. One device, which is known as a voltage clipper, includes a set of five silicon diodes connected in series. A sixth diode is connected across the set in opposite polarity [see illustration at right].

"Voltage is applied to the diodes through a resistor by a step-down transformer that reduces the power-line potential to 12 volts. When an alternating current is applied to the clipper, the potential across the string of five diodes rises until, at three volts, the diodes begin to conduct. Thereafter the voltage remains constant until the applied potential falls below three volts. Similarly, when the current from the power source reverses, the potential across the single diode increases to about .6 volt and thereafter remains constant until the applied potential falls below .6 volt. The result is a pulse of 3.6 volts with a Hat top and steeply sloping sides. This pulse is used to operate the second pulse-shaping device: an electronic switch called a monostable multivibrator. When the switch is triggered by the incoming pulse, it closes, then remains closed for an adjustable interval and opens automatically. Typically the interval during which the voltage rises or falls is measured in billionths of a second.


Terminal arrangement, top view

"Pulses thus formed are applied for division to a series of four synchronous counters, each of which contains four flip-flops together with NAND gates and a network of interconnections. The first device in the series, a Type 7492 divideby-12 counter, contains four flip-flops. Three of them are interconnected to form a synchronous divide-by-6 counter. The fourth flip-flop, which is not used in this application, is available as a separate J-K flip-flop that divides by 2.


NOR-gate crystal oscillator

"The divide-by-6 portion of the device reduces the output frequency of the monostable multivibrator to 10 hertz, meaning individual periods of .1 second each. At this frequency the output is available externally for use as a timing signal. It is also applied for division by 10 to the input of a Type 7490 synchronous decade-counter.

"In addition to reducing the frequency to one cycle per second, this device was wired to equalize the interval during which the pulse persists and the interval between pulses. Therefore voltage at the output terminal of the counter is on for half a second and off for half a second. The scheme is known as symmetrical frequency division. Another Type 7490 decade-counter similarly divides the one-hertz frequency to one pulse per 10 seconds. The final division is made by a 7492 divide-by-12 counter that is wired to divide by 6, thus reducing the frequency to one pulse per minute.


NOR-gate inputs and output

"The output of each counter is connected by a four-position switch to the input of a Type 74121 monostable multivibrator. An identical four-position switch connects any one of four capacitors to the multivibrator. The capacitors control the duration of pulses generated by the multivibrator. In this instrument pulses can be selected that persist for intervals of .007 second, .07 second, .35 second and .7 second. "Some experiments require a time base of greater accuracy than is provided by the frequency of power lines, particularly in communities served by generating stations that are not connected to interstate power grids. A time base of sufficient accuracy for most experiments can be generated by a simple oscillator consisting of a quartz crystal ground to vibrate at, say, a million cycles per second, two capacitors, two resistors and a pair of Type 7402 NOR gates. This device, which contains four independent NOR gates, is priced at $1.25 in lots of one to nine.


Capacitor values

"The circuit generates pulses of approximately rectangular shape that will operate a multivibrator [see illustrations at upper right, upper left and right]. The output of the multivibrator can be divided by any desired combination of counters in a circuit similar to the one used for dividing the frequency of a power line. Make at least the first division by a synchronous counter to ensure reliable operation.

"Devices that display the output of digital circuits are as diverse as the applications for which the circuits are designed. Perhaps the simplest readout device consists of a light-emitting diode connected between the output and the ground through a resistor of about 25 ohms.

"A few special materials and procedures have been developed that simplify the construction of integrated-circuit devices. Plastic sheets about a sixteenth of an inch thick perforated with a rectangular grid of small holes spaced .1 inch apart are commonly used for mounting dual-in-line packages. The perforated sheets are available commercially as the Vector Integrated Circuit Board, Pattern P.

"I mount 7400-series devices side by side, spaced half an inch apart, by pushing the terminals through the holes. Two lengths of straight, bare No. 14 copper wire are installed parallel to the ends of the devices on the terminal side of the board. One length of wire interconnects the power supply and the five-volt terminals of all devices. The second wire serves as the common ground connection. Circuit connections are made by pushing bare No.24 copper wire into the hole that contains the terminal and fastening the joint with a dab of solder. The soldering is done with a pencil-size iron that draws less than 35 watts. I use 60/40 tin-lead solder wire .05 inch in diameter. The wiring is insulated as required with PVC plastic tubing, size No.24.

"I test circuits repeatedly during construction, beginning with the power supply. If the power supply does not work, nothing else will. It is easier to track down an error in a small section of a circuit than to locate trouble when the entire system fails. According to Murphy's law, the probability of making an error increases with the square of the number of connections that must be made, and so does the difficulty of locating errors in a circuit after the job is finished.

"I buy new components from Allied Electronics Corporation (2400 West Washington Boulevard, Chicago, Ill. 60612). A selection of hew surplus devices is available at a fraction of the list price from dealers such as Babylon Electronics (P.O. Box 4, Carmichael, Calif. 95608) and Poly Paks (P.O. Box 942R, Lynnfield, Mass. 01940)"

 

Bibliography

DESIGNING WITH TTL INTEGRATED CIRCUITS Staff, Texas Instruments Incorporated, 1971.

FAIRCHI1D SEMICONDUCTOR TTL DATA BOOK. Fairchild Semiconductor, 1973.

THE LOGIC DESIGN OF TRANSISTOR DIGITAL COMPUTERS. Gerald A. Maley and J. Earle. Prentice-Hall, Inc., 1963.

 

Suppliers and Organizations

The Society for Amateur Scientists (SAS) is a nonprofit research and educational organization dedicated to helping people enrich their lives by following their passion to take part in scientific adventures of all kinds.

The Society for Amateur Scientists
5600 Post Road, #114-341
East Greenwich, RI 02818
Phone: 1-401-823-7800

Internet: http://www.sas.org/