Vous êtes sur la page 1sur 12

# Introduction to Digital Logic Circuits

## Short History of Digital Logic

In 1835, Joseph Henry invented the electro-mechanical relay. The relay is a device in which a small
current in the relay coil can close the relay contacts and allow larger currents to flow in an electrical
circuit. It is a common component in digital logic circuits. In 1845, George Boole developed a
mathematical theory of logic which is fundamental to the design of digital logic circuits. It wasn’t until
1937 that Claude Shannon, an Electrical Engineer at MIT noted that Boolean algebra applies to relay
and switching circuits. He wrote “A Symbolic Analysis of Relay and Switching Circuits” as his
master’s thesis, which he later published. The significance of this is that Claude Shannon is
considered the founder of practical digital circuit design theory. Shannon provided several examples
using his logic design methods: an electric combination lock, an adder, a voting machine and a
circuit that would find factors and prime numbers. (He suggested that relay logic, operating at five
operations per second, could more accurately and faster perform what a mathematician took twenty
years to accomplish. He estimated it would take two months for his device to accomplish the same
work.)

In 1947, Bardeen, Braittain and Shockley invented the transistor at Bell Labs. This resulted in solid
state switching, that is much faster and more reliable than relays. This enabled the creation of large
and powerful computers. In 1958, Jack Kilby and Robert Noyce invented integrated circuits that
enabled more and less expensive digital circuits in a smaller package. These were used in the space
program in which weight is an important factor. In 1969, Dick Morley invented the first
Programmable Logic Controller (PLC), the MODICOM Model 84. The PLC is designed for the more
rugged applications and more power that is required for manufacturing. These devices have
replaced control relays in many manufacturing areas. In 1971, Robert Noyce and Gordon Moore
introduced a “Computer on a chip”. It executed 60,000 operations per second which is substantially
more than the 5 operations per second for Shannon’s relay logic device. Improvements in
integrated circuits and microprocessors have enhanced the functionality of Programmable Logic
Controllers. In mid 1970’s through 1980’s, Allen Bradley produced PLC1 through PLC5 series of
Programmable Logic Controllers using integrated circuits and microprocessors. In 1980, IBM started
production of the IBM Personal Computer (PC) which made computing available to all. The PC is
useful for both programming Programmable Logic Controllers and for the analysis and design of
digital logic circuits. In addition to computers and the PLC, digital circuits are used in cell phones
and other mobile devices, automobiles, medical devices, security systems, household appliances,
energy management systems and High Definition Television (HDTV).

## Boolean Algebra Fundamentals

Unlike other algebras, Boolean algebra allows only two possible values: 0 or 1. The two value
representation is often referred to as a bit (Binary digit). The bit can represent on or off, true or false,
or yes or no. Input variables such as A, B, C are used in logic expressions to represent switches, relay
contacts and sensor inputs. The input variables can represent push button switches, limit switches,
temperature sensitive switches, pressure switches, level switches, proximity sensors, light sensors,
and weight sensors. The results of the logical expression are to perform some action: turn on or off
solenoids, relays, motors, lights, buzzers, alarms and other output devices. Boolean algebra has only
three basic operations: NOT or Negation, AND ( · ), and OR (+).

The NOT operation changes the value to the complement of the value. It changes a 1 to a 0, and a 0
to a 1. It can be represented by a bar over the variable. This is also referred to as inversion or
negation.

The AND operation is a Boolean multiply and is 1 only when all values are 1. This is represented in
Boolean variables as A · B = Y or AB = Y. The AND is like the old string of Christmas lights. All the

Page 1 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

lights have to work to have the string light. The AND operations for A · B = Y are shown for each input
value.

A·B=Y
0·0=0
0·1=0
1·0=0
1·1=1

The OR operation results in a 1 if any of the values are 1. In Boolean algebra, 1 + 1 = 1 is valid.
Logically the statement means if there are one or more true values, the result is true.

A + B = Y
0+0=0
0+1=1
1+0=1
1+1=1

## Special Properties Associated with Boolean Logic Operations

There are properties of Boolean operations that are important in working with logic expressions.
Using these properties, Shannon showed that logical expression can be expanded and simplified
which in turn resulted in simpler logic and reduced the number or relays and switches.

Commutative: A + B = B + A

A·B = B·A

Changing the order of the input variables does not change the result.

Associative: (A + B) + C = A + (B + C)

(A · B) · C = A · (B · C)

Changing the order of the logical operations does not change the result.

## The input variables are distributed to the individual terms.

Identity: 1 · A = A, 0 + A = A

1 AND a variable is the same as the variable, 0 OR a variable is the same as the variable.

Page 2 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

Complement: A + Ā = 1, A · Ā = 0

## The NOT of A AND B is the same as NOT A OR NOT B

Example

Using these properties, logic expressions can be simplified. The expression A·B + Ā·B can be
rewritten as B(A + Ā), which is B · 1 or simply B. This shows that instead of two switches, A and B,
only one switch, B is needed.

Each variable in a logic equation has two possible values. For each variable added to the equation,
the number of combinations and possible solutions doubles. The number of solutions related to the
number of variables is exponential: 2n , where n is the number of variables. For example, a circuit
with ten switches requires ten variables and can have 2 10 or 1024 possible combinations and
solutions. As the number of switches and sensors increase, the design becomes much more
difficult.

Algebraic equations do not always have a solution. When an equation does not have a solution it is
called a contradiction. An example of a contradiction is A = Ā. This equation states that A is equal to
NOT A, or A is not A. When A is 1, Ā is not 1. There is no combination of one’s and zero’s that will
make the equation correct, so this equation is a contradiction. There is a similar equation, but the
results are a unique solution: A·B = Ā. This equation is correct only when A = 1 and B = 0, and no
other combination. Even though this is a valid equation, since A and B values are fixed, neither A or
B are switches. If switches were used, switch A would always be on, and switch B would always be
off. This would be a waste of two switches. In more complicated logic, there can be situations where
the logical result does not change whether the switch is on or off. In these cases, it is likely the
switch is not needed.

## Ladder Logic and Logic Gates

Originally digital logic was accomplished only through switches and relays. Switches and Relays are
still commonly represented in Ladder Logic Diagrams (LLD). In Ladder Logic, logic is defined using
rungs. On the left, contacts define the logic operations. On the right is the output of the logic. These
are shown below for the basic logic operations: NOT, AND and OR. Digital logic is also implemented
using digital electronic circuits called logic gates. Gates serve as the building blocks to more
complex electronic digital logic circuits. They are fundamental to the design of computers. Digital
logic using transistors is often referred as Transistor-Transistor Logic or TTL. The basic electronic
digital operations are also NOT, AND, OR, but there are combinations of these that are also
commonly used: the NAND, NOR, and XOR.

Page 3 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

NOT Logic

## Normally closed contact Power On

|--------------------]\[----------------------------------------( )-----------|

With the Normally closed contact not activated, the Power On output is on. When the Normally closed
contact is activated or is “on”, the Normally closed contact opens and the Power On output is off.
NOT gates that perform the same function have a single input and a single output. A symbol for a
NOT gate is a triangle with a circle on the right. The circle indicates "negation". The NOT logic gate
symbol is given below along with the Boolean equation:

Ā=Y

A truth table shows all the possible combinations and the outputs for a logic equation. The truth
table for the NOT operation is shown below:

A Y
0 1
1 0

AND Logic

In Ladder Logic, the AND operation consists of two or more normally open contacts in series.

A B Out
|----------------] [---------------] [---------------------( )----------|

The above shows two contacts on the rung. Additional contacts could be added to the rung as
required. An AND gate can have two or more inputs and has a single output. The output of the AND
gate is 1 only if all inputs are 1. Otherwise, the output is 0. An AND gate symbol for a two input AND
gate is shown below along with the Boolean equation.

A·B = Y or AB = Y

Page 4 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

## The truth table of a two input AND logic is the following:

A B Y
0 0 0
0 1 0
1 0 0
1 1 1

OR Logic

In Ladder Logic, the OR operation is two or more parallel contacts. Below shows two contacts
connected for OR logic. Adding another contact in parallel would add another term in the OR logic.

A Out
|-----------------] [-------------------|--------------( )------------|
| B |
|-----------------] [-------------------|

An OR gate can have two or more inputs and has a single output. The output is 1 when one or any
other of the inputs is a 1. An example is having both remote control and keypad entry on a garage
door. Either will open the garage door. The OR gate symbol for a two input OR gate along with the
Boolean equation is given below:

A + B = Y

## The truth table defines the output of a two input OR logic.

A B Y
0 0 0
0 1 1
1 0 1
1 1 1

Page 5 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

NAND Logic

The NAND is common in designing of electronic digital logic circuits, but it can also be represented in
Ladder Logic by two normally open contacts and NOT output ( / ). The NOT output reverses the logic
of the output. In the case of two normally open contacts, when both contacts are activated, the
output is deactivated or off. The NAND gate is the negation of AND logic. The symbol for a two input
NAND is given below:

The truth table defines the output of two input NAND logic:

A B Y
0 0 1
0 1 1
1 0 1
1 1 0

NOR Logic

A NOR operation using Ladder Logic contains parallel contacts, the OR operation with the NOT output
( \ ). NOR gates have two or more inputs and a single output. The output of NOR gate is the negation
of OR. A two input NOR gate symbol is shown below:

The truth table for a two input NOR logic is given in the following table.

A B Y
0 0 1
0 1 0
1 0 0
1 1 0

Page 6 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

XOR Logic

XOR refers to Exclusive OR Logic. Exclusive OR logic is defined using a combination of AND, OR, and
NOT logic. Using Ladder Logic, XOR is a combination of parallel (OR logic), series (AND logic),
normally closed (NOT logic), and normally opened contacts:

AB + AB = Out

NOT A B Out
|---------------]\[------------|--------------] [---------------|---------( )-------|
| A | NOT B |
|---------------] [-------------|--------------]\[--------------|

XOR gates have two inputs and a single output. The output of an XOR gate is 1 only if the input
variables have opposite values. A two input XOR gate symbol is shown below along with the Boolean
equation:
AB + AB = Y

If you look carefully at the drawing of the gate, there is a second arc behind the first one near the
inputs. The truth table for the Exclusive OR logic is provided in the following table:

A B Y
0 0 0
0 1 1
1 0 1
1 1 0

The special quality of this logic is that it is the numeric addition of two binary inputs. If combined
with an AND for the carry, it is a basic circuit element for an adding circuit.

## Switching Logic Example

Let’s look at an example of a conveyer. This is like the conveyer at a discount store or supermarket.
To move the items to the checkout, there is a conveyer powered by a motor that is controlled by
three switches: An “ON” switch, an “OFF” switch and a “Limit” switch. The Limit switch is on when
an item is detected on the conveyer close to the checkout area. The ON switch should turn on the
motor only as long as neither the OFF switch or Limit switch are “on.” If A is the ON switch, B is the
OFF switch and C is the Limit switch, then the logic equation is

A • B• C = M

Page 7 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

Listing each possible combination of the switches allows us to see if there are combinations that
may cause problems. When the logic output depends only on the inputs, the logic is referred to as
combinatorial logic. The truth table shows that the motor will only run when the ON switch is on and
neither the OFF Switch or Limit switch is on. All other combinations are 0, which means the motor
will not be on for any other combination. This is what is wanted in this case.

Truth Table

## ON Switch (A) OFF Switch (B) Limit Switch (C ) Motor (M)

0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 0

A B C Motor

|-----------] [-----------]\[------------]\[-------------------------(M)----------|

## Sequential Logic Design

When the input is combined with the previous state of the logic circuits, it is referred to as sequential
logic. The use of the previous state is called feedback. A seal-in circuit is an example of a sequential
logic circuit. The seal-in relay circuit allows one to press the start button to start a motor that
activates a seal-in contact. Even when the start button is released the motor will continue to run.
This occurs because the motor contact is in parallel with the start button and remains “on “as long
as the motor is on. In this sense, a sequential logic circuit can have memory.

Page 8 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

## |---------------]\[-----------|--------------] [-------------|---------( M )-------|

Stop Button | Start Button | Motor
|--------------] [-------------|
Motor (Seal-in contact)

A seal-in circuit is also referred to as a latch. In ladder logic, a latch instruction performs the same in
that it sets the output to 1 when a push button is momentarily pressed. There is an Unlatch
instruction that resets the output to 0. This is shown on the following ladder logic diagram.

Out
|----------------] [--------------------------------------(L)-----------|
Start Button
Out
|----------------] [-------------------------------------(U)-----------|
Stop Button

|----------------] [-------------------------------------(M)----------|
Out

Logic gates can also form latches. Using gate logic, a latch can be created using two NOR gates with
feedback to the inputs. The symbol for a latch can also be a rectangular box as shown below:

## A momentary 1 on S sets the Q to 1. A momentary 1 on R resets the Q to 0.

The ability to have available the previous output is important in creating a sequence of actions based
on the state of previous actions or states. An assembly line can have actions based on whether a
bottle is in a certain position, whether it is filled to a certain level, or whether the label is present.
This also applies to situations such as whether a motor is going forward or reverse, whether a door is
open or closed, or whether someone entered the right code.

## Asynchronous and Synchronous Logic – The need for speed.

Logic circuits can be designed using either asynchronous or synchronous logic. In asynchronous
logic, logic transitions can happen anytime. Theoretically, asynchronous logic will operate as fast as
the individual logic devices allow. However, since asynchronous logic can transition at any time, the
circuit design is more difficult. To avoid logic problems from the variability of the timing, additional
circuits are used to ensure the logic is valid. The logic can require more gates to be sure the output
is not set while the logic is changing within the circuit. Since a clock is not needed to synchronize all
the logic outputs, asynchronous logic can be less dependent on power than synchronous logic.
Asynchronous logic can be a better solution in mobile digital devices that run on batteries.

Page 9 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

Synchronous logic uses a clock to ensure transitions in logic occur at the same time. Latches can be
synchronized to a clock so the output only changes when a clock edge is present. The clock is
distributed throughout the circuits to be sure that transitions in logic occur at the same time.
Synchronous logic circuits use more power than asynchronous logic because of the clock.
Synchronous logic circuits can be easier to analyze because logic transitions occur at specific times.
The more complex logic circuits are synchronized. Clocks on complex digital circuits such as
microprocessors run at 3.0 Gigahertz, (3,000,000,0000 cycles per second) or more. In these
circuits, an edge of the clock cycle is used to set the logic states, and transitions are only allowed
between clock cycles.

Timing of logic circuits is important because it can affect the logical result. Electrical and mechanical
switches do not transition from on to off instantaneously, and neither do electronic logic circuits.
Even though it may take a short time for a logic transition, the logic output can be invalid during the
transition. Since in all digital logic circuits there are times when logic is changing, it is important that
the outputs are not used during transitions. Another factor that can change logic results is the
inherent delay each logic device has. Simultaneous logic transitions can take different paths through
the logic devices. This can skew the timing of the logic transitions and change the logic results. This
is referred to as a race condition. When the delays affect the outcome, there is a problem with the
logic circuit

Timing Diagrams

Timing diagrams are important to determine if there is an unexpected logic output because of the
timing of the inputs. Timing diagrams show the relation of logic inputs and the outputs over time.
Examining the logic over time is important because it shows how changes in inputs affect the logic
output.

Let’s look at a situation in which you want a press to be activated only when the operator presses
both left and right push buttons. Consider the situation in which the buttons are separated so that
the operator has to use both hands for safety reasons. Pushing the buttons can occur at any time.
These are asynchronous inputs. The operator needs to press both buttons and the equipment
should operate only when both are pressed. AND logic is appropriate because we want the
equipment to operate only when both hands are on the pushbuttons.

## Example of a Timing Diagram

On _____________________
Left Button Press Off __________ __________________
On ______________________
Right Button Press Off _______________ ____________
On ________________
AND Logic Output Off _______________ _________________

Page 10 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

In practice, logic circuits can involve a number of inputs and a variety of scenarios or modes of
operation. This timing diagram shows one scenario and the expected results. There are other ways
the operator could press the Left and Right Buttons that would change the logical output.

## Beyond The Basics

Complex digital logic circuits are built using the basic logic circuits given above, even the advanced
microprocessors. There is a variety of digital logic circuits formed using gates: timers, counters,
adders, registers, multiplexers and decoders. Rather than show all the logic gates, they are often
represented using rectangular boxes, in which their function is labeled along with important settings.
The following shows two examples: a delay timer and count up circuit.

Logic circuits can sequence assembly line operations, open doors using sensors, control entry
through combination locks and sequence traffic lights. When combined to form computers, you can
have many more applications.

Conclusion

This course has provided an introduction to the fundamentals of digital logic circuits. Since digital
logic circuits are used in so many devices, it is useful to have some understanding of their operation.
Even though the digital logic circuits are becoming more complex, they are still built from the basic
logic components. In the following references, there are web sites that have tutorials that can
provide further information on digital logic circuits and also simulations that one can use to design
and experiment with digital logic circuits.

Page 11 of 12
Introduction to Digital Logic Circuits
James Vogel P.E.

References

Bertrand, Roger M., Programmable Controller Circuits, Delmar Publishers, International Thomson
Publishing, Inc., Albany N.Y., 1996

2005

## Breeding, Kenneth, Digital Design Fundamentals, Prentice-Hall, Englewood Cliffs, N. J. 1989

Chen, Wai-Kai, Logic Design, CRC Press, Boca Raton, FL, 2003

Fabricus, Eugene D., Modern Digital Design and Switching Theory, CRC Press, Boca aton, F. L., 1992

## Shannon, C. E., A Symbolic Analysis of Relay Switching Circuits. Massachusetts Institute of

Technology, Department of Electrical Engineering, 1940

## Related Web Sites

http://www.en.wikipedia.org/wiki/George_Boole
http://www.en.wikipedia.org/wiki/Claude_Shannon
http://www.gutenberg.org/author/George_Boole
http://www.bell-labs.com/news/2006/october/shannon.html
http://www.plcdev.com/plc_timeline