Take a single transistor. Add another. And another. And another. From the combination of these relatively simple electronic devices come familiar logic circuits such as flip-flops, registers, decoders, input/output interfaces, and memory. In turn, these modules combine to form larger systems like PCs, PLCs, and digital motion controllers. Knowing how digital logic circuits combine, scale, and operate is vitally important for anyone involved in motion system design today.

Digital logic, the numerics behind the computers or math engines of industry, is based on a binary system, where information is sent and received as bits: 0's and 1's. On transistors, these bits correspond to low and high voltage levels. When arranged in a particular sequence, bits — short for binary digits — represent and communicate information such as temperature (measured by a sensor) or speed (in a drill press).

Less is more

Binary digits carry out a myriad of functions; for example, they execute mathematical operations and transcribe the alphabet into numerical representations. While the binary system (base 2) is a machine's common language, three other numeric systems also apply: decimal or base 10 (the mathematical shorthand used in everyday life), octal base 8, and hexadecimal (hex) base 16.

One advantage to working in octal or hex is that it compacts the digits. As such, eight digits in hex can represent a group of 32 individual bits (32/4). Likewise, ten digits in octal can represent a group of 30 bits (30/3). The divisor depends on the power to which the base 2 equivalent is raised.

Octal bits range from 0 to 7 (digits 8 and 9 do not exist); hex ranges from 0 to 9 and includes the first six letters of the alphabet, A through F, which stand for 10 through 15. Binary-to-octal conversion requires partitioning every three bits, working from the decimal point outward in both directions. To the decimal's left, each bit in the set translates to 20, 21, 22 (working from right to left) and repeats for the next set of three bits. Sets must be summed to determine their octal (0 to 7) matches. Binary-to-hex conversions are similar, except that divisions occur every four bits.

Translation station

Converting between systems is desirable, but mathematically manipulating the converted material is even better. All arithmetic operations calculated in decimal can be calculated in the other three systems. For instance, binary addition is exactly like decimal addition, except that it produces a result made up entirely of 0's and 1's. However, there is one trick: 1+1=0. In decimal, a digit carries when the sum exceeds nine. When the total exceeds 1 in binary, the additional 1 carries to the next column at left. When adding 1+1+the carry bit 1, the result is 1 with a carry of 1 to the next column.

The easiest way to carry out arithmetic operations is by working in binary and then converting to octal or hex. To work in the opposite direction — such as converting hex to binary — it is easiest to first convert to decimal and then binary.

Mixing logic and numbers

A basic digital circuit, or logic gate, compares at least two inputs to produce one output. Logic gates are actually simplified representations of transistors and other electronics, which allow the end user to disregard internal circuitry and focus on input/output. When multiple logic gates connect for a specific function, a digital circuit is born. The three most common logic operations (and the basis of Boolean algebra) are AND, OR, and NOT.

Telling the truth

Bits 0 and 1 serve as inputs and outputs. Each logic operation can be represented by a truth table, an array of outputs generated by a given set of inputs. In the case of an AND gate, the output can only be true (or equal to 1) when both A and B are high. For an OR gate to be true, either the A or B input must be high. And in the case of a NOT gate (inverter), only one input enters and always outputs the inverse. Other gates common to logic systems include NAND and NOR (opposite outputs of AND and OR), XOR (exclusive OR — outputs are high when only one input is high), XNOR, and a buffer (input equals the output).

Gated community

The more simplified a gate and its connections, the more gates that can fit onto a silicon chip. These integrated circuits come in four different packages:

  • SSI — Small-scale integrated devices accommodate up to 10 gates. All inputs and outputs connect directly to the pins.

  • MSI — Medium-scale integrated devices contain 10 to 100 gates and execute basic addition.

  • LSI — Large-scale integrated devices contain 100 to a few thousand gates found, for instance, on motherboards.

  • VLSI — Very large-scale integrated devices contain several thousand to hundreds of millions of gates and are the most common package. They function as microprocessors and DSPs and execute complex tasks.