### Digital Circuits

All binary digital devices and systems employ high-speed electronic switches that perform Boolean operations. These switches are called logic gates. By combining logic gates, sophisticated digital systems can be built up. Even the most advanced computers are, at the basic level, comprised of logic gates.

#### Positive and Negative Logic

Usually, the binary digit 1 stands for “true” and is represented by a voltage of about +5 V. The binary digit 0 stands for “false” and is represented by about 0 V. This is positive logic. There are other logic forms, the most common of which is negative logic. In a common form of negative logic, the digit 1 (the logic high state) is represented by about 0 V, and the digit 0 (the logic low state) is represented by about +5 V. The remainder of these topics deals with positive logic.

#### Basic Gates

An inverter or NOT gate has one input and one output. It reverses the state of the input. An OR gate can have two or more inputs. If both, or all, of the inputs are 0 (low), then the output is 0. If any of the inputs is 1 (high), then the output is 1. An AND gate can have two or more inputs. If both, or all, of the inputs are 1, then the output is 1. Otherwise the output is 0.

#### Other Gates An inverter or NOT gate (A), an AND gate (B), an OR gate (C), an XOR gate (D), a NAND gate (E), and a NOR gate (F).

Gate type Number of inputs Remarks
NOT

OR

1
2 or more
Changes state of input.

Output high if any inputs are high.

AND 2 or more Output low if any inputs are low.
Output high if all inputs are high.
NOR 2 or more Output low if any inputs are high.
Output high if all inputs are low.
NAND 2 or more Output high if any inputs are low.
Output low if all inputs are high.
XOR 2 Output high if inputs differ.
Output low if inputs are the same.

Sometimes an inverter and an OR gate are combined. This produces a NOR gate. If an inverter and an AND gate are combined, the result is a NAND gate. An exclusive OR gate, also called an XOR gate, has two inputs and one output. If the two inputs are the same (either both 1 or both 0), then the output is 0. If the two inputs are different, then the output is 1. The functions of logic gates are summarized in above table. Their schematic symbols are shown in above figure

#### Black Boxes

Logic gates can be combined to form circuits with many inputs and outputs. When two or more logic gates are combined, the outputs are always specific logical functions of the inputs. A complex combination of logic gates is sometimes called a black box.

The functions of a black box can always be determined using Boolean algebra, if the gates inside, and the way they are interconnected, is known. Conversely, if a certain complex logical function is needed for an application, a black box can be designed to perform that function by using
Boolean algebra to break the function down into components of NOT, OR, AND, NOR, NAND, and XOR.

#### Forms of Binary Data

In communications, binary (two-level) data is less susceptible to noise and other interference than analog or multilevel digital data. There are several forms.

• Morse code is the oldest binary means of sending and receiving messages. It is a binary code because it has only two possible states: on (key-down) and off (key-up). It is used mainly by amateur radio operators in their hobby activities. A “human ear/brain machine,” scrutinizing
a Morse code signal, is an amazingly effective digital communications receiver.
• Baudot, also called the Murray code, is a five-unit digital code not widely used by today’s digital equipment, except in some radioteletype communications.
• ASCII (American National Standard Code for Information Interchange) is a seven-unit code for the transmission of text and some programs. Letters, numerals, symbols, and control operations are represented. ASCII is designed for computers. There are 27, or 128, possible representations. Both upper- and lowercase letters can be represented, along with numerals and certain symbols.

#### Flip-flops

A flip-flop is also known as a sequential logic gate. In a sequential gate, the output state depends on both the inputs and the outputs. A flip-flop has two states, called set and reset. Usually, the set state is logic 1 (high), and the reset state is logic 0 (low). Here are some common types.• R-S flip-flop inputs are labeled R (reset) and S (set). The outputs are Q and −Q. (Often, rather than −Q, you will see Q′, or perhaps Q with a line over it.) The outputs are always in logically opposite states. The symbol for an R-S flip-flop, also known as an asynchronous flipflop, is shown in above figure A. The truth table (a specialized form of table denoting logic functions) for an R-S flip-flop is at below Table A.

• Synchronous flip-flop states change when triggered by the signal from a clock. In static triggering, the outputs change state only when the clock signal is either high or low. This type of circuit is sometimes called a gated flip-flop. In positive-edge triggering, the outputs change state at the instant the clock pulse is positive-going. The term edge triggering derives from the fact that the abrupt rise or fall of a pulse looks like the edge of a cliff (Fig. 26-3B). In negative-edge triggering, the outputs change state at the instant the clock pulse is negative going.
• Master/slave (M/S) flip-flop inputs are stored before the outputs are allowed to change state. This device essentially consists of two R-S flip-flops in series. The first flip-flop is called the master, and the second is called the slave. The master flip-flop functions when the clock output is high, and the slave acts during the next low portion of the clock output. This time delay prevents confusion between the input and output.
• J-K flip-flop operation is similar to that of an R-S flip-flop, except that the J-K has a predictable output when the inputs are both 1. Table 26-3B shows the input and output states for this type of flip-flop. The output changes only when a triggering pulse is received. The symbol for a J-K flip-flop is shown in Fig. 26-3C.
• R-S-T flip-flop operation is similar to that of an R-S flip-flop, except that a high pulse at the T input causes the circuit to change state.
• The T flip-flop has only one input. Each time a high pulse appears at the T input, the output state is reversed.

A:

R-S Flip-flop R S Q -Q
0 0 Q -Q
0 1 1 0
1 0 0 1
1 1 ? ?

B:

J-K Flip-flop R K Q -Q
0 0 Q -Q
0 1 1 0
1 0 0 1
1 1 -Q Q

#### Clocks At A, the symbol for an R-S flip-flop. At B, pulse edges are either negative-going or positive-going. At C, the symbol for a J-K flip-flop.
In electronics, the term clock refers to a circuit that generates pulses at high speed and at precise intervals. It sets the tempo for the operation of digital devices. In a computer, the clock acts like a metronome for the microprocessor. Clock speeds are measured and expressed in hertz (Hz), kilohertz (kHz), megahertz (MHz), or gigahertz (GHz).

#### Counters

A counter consists of a set of flip-flops or equivalent circuits. Each time a pulse is received, the binary number stored by the counter increases by 1. A frequency counter measures the frequency of a wave by tallying the cycles in a given interval of time. The circuit consists of a gate, which begins and ends each counting cycle at defined intervals. The accuracy is a function of the length of the gate time; the longer the time base, the better the accuracy. The readout is in base-10 digital numerals.