Electronics is commonly defined as the science of electrical conduction in a vacuum, gases or semiconductors, and of devices that use these phenomena, such as transistors and diodes. Logic gates—also called logic operators or gates—are electronic devices assembled from other components and provide a physical implementation of Boolean operators. In practice, designers usually use integrated circuits containing complete gates rather than building them component by component.
Digital signals and Boolean logic
Unlike linear or analog electronics, digital electronics processes discrete signals with just two possible states. A signal switches rapidly between its limits; theoretically, there are no intermediate states. These limits represent high and low logic levels, often denoted by binary “1” and “0.” A convention sets the minimum and maximum voltage for each level. In positive logic, “1” is high and “0” is low, which can even mean a negative voltage. Negative logic reverses that assignment: “1” is low and “0” is high.
For example, if a system uses signals of 0 and 5 volts, the ranges assigned to each logic value could be as shown here.
Voltage levels for “0” and “1”.
Printed circuit board with digital gates.
Boolean algebra, named after English mathematician George Boole, who first defined this logical system in the mid-19th century, is the mathematical tool used to analyze digital electronic circuits. Boole applied algebraic techniques to propositions in logic; Boolean algebra is now widely used in electronic design. In 1938, Claude Shannon was the first to use bistable electrical switching circuits built from switches and relays.
Today, digital logic circuits are made from discrete electronic components packaged in chips. These often group several gates of the same type, although chips implementing almost any required logic function are available. Logic gates are the basic elements of a digital circuit. Think of each gate as a black box: values go in, and the result appears at the output. A truth table lists every possible input combination and the corresponding output.
The gates covered here are IF, NOT, AND, OR, NAND, NOR, XOR and NXOR.
IF gate
The IF gate (also called YES) performs the Boolean identity function. It is drawn as a triangle, with the input at its base and the output at the opposite vertex. Its truth table is simple: the output always matches the input. In electronics, IF gates are often used as current amplifiers, or buffers, allowing a weak-current device to control a load that draws more current.
Figure 1. IF (YES) gate
NOT gate
A NOT gate produces the opposite value at its output from the value at its single input. It performs logical negation and is used whenever the complement of a given logic value is needed. Its circuit symbol is the same as the IF gate’s, with a small circle at the output to indicate inversion.
NOT gate and its truth table.
AND gate
An AND gate performs Boolean multiplication. Its output is “1” only when every input is high; otherwise, the output is “0.” The AND operator is associated with multiplication, just as IF is associated with identity. Multiplying binary values gives “1” only when all of them are 1. The operation is commonly written with the “×” symbol.
One way to picture an AND gate is as a lamp in series with a power supply and two or more switches. The lamp lights only when every switch is closed. The switches represent the inputs, and a closed switch represents “1.” If any switch is open (“0”), current does not flow and the output remains “0,” so the lamp is off.
The illustration shows a two-input AND gate, but versions with three, four or more inputs are also available.
AND gate and its corresponding truth table.
OR gate
The Boolean OR function corresponds to addition and is written “+.” The output is high (“1”) if at least one input is high; otherwise, it is “0.” An equivalent circuit has a lamp and two switches connected in parallel. If both switches are open (“0”), the lamp stays off. Closing either switch is enough to turn it on. As with AND gates, OR gates can have more than two inputs.
Two-input OR gate and its truth table.
NAND and NOR gates
A NAND gate is an AND gate followed by a NOT gate: it is the negation of AND. Its output is “0” only when all inputs are “1.” The small circle at the output represents inversion. NAND gates have at least two inputs, and versions with three or more are also common.
NAND gate diagram and truth table.
Similarly, a NOR gate is an OR gate with a NOT stage at its output. Its output is “1” when all its inputs are “0.” In circuit diagrams, a circle at the output marks the inversion; NOR gates may have more than two inputs.
NOR gate diagram and truth table.
XOR and NXOR gates
The OR gate performs inclusive OR: one or both inputs can be “1” for the output to be “1.” Consider the everyday statement, “Tomorrow I’ll go shopping or to the cinema.” It is true if either activity happens, and it remains true if both do. XOR differs: its output is “1” only when the inputs differ. In this example, the result would be “1” if only one activity happened, and “0” if neither happened or both did.
This property makes XOR useful for adding numbers, as in calculators, a topic we will return to in later articles.
XOR gate diagram and truth table.
An NXOR gate is simply an XOR gate with its output inverted. The figure shows the truth table and circuit symbol for a two-input NXOR gate.
NXOR gate and its corresponding truth table.
Combining gates and integrated circuits
Using the black-box model, it is straightforward to connect gates together, feeding the output of one into the input of another, to create any truth table we need. Digital gates can produce the required output conditions for given inputs. Other techniques, which we will cover in future articles, can help avoid unnecessary gates.
As noted earlier, gates are packaged in integrated circuits. Several chip families are grouped by their electrical characteristics. Members of a family generally share the same manufacturing technology, which determines their maximum switching speed, the voltages representing logic “0” and “1,” how many gates can be connected to a given output, and the power dissipated by each gate, among other parameters. These differences usually mean chips from different families cannot be mixed in one electronic circuit, though there are exceptions.
In upcoming articles, we will build a range of interesting circuits using chips from the two most common families, CMOS and TTL. Both families offer chips containing all the gates covered here, along with many combinations and other elements that are useful—and essential—when designing digital electronics.
Example circuit using NAND and NOR gates.
Fairchild Semiconductors
More information: Texas Instruments
More information: National Semiconductors
Maxim - Dallas