# Chapter 7 - Dyessick

```Chapter
7
Programming Logic Gate
Functions in PLCs
Objectives
• Describe combinational and sequential
logic gate circuits.
• Create PLC ladder logic programs for
NOT, AND, OR, NAND, NOR, XOR, and
XNOR logic gates.
• Create Boolean expressions and logic gate
circuits from truth tables.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Objectives
• Use the Logic Converter instrument in NI
Multisim to create logic tables and Boolean
expressions from logic gate circuits.
• Convert Boolean expressions to PLC
• Convert PLC ladder logic diagrams to logic
gate circuits and Boolean expressions.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Combinational Logic Gates
•
•
•
•
Do not require clock pulses to operate.
Outputs depend only on their inputs.
Outputs are generated instantaneously.
Simply called logic gates.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Logic Gates
•
•
•
•
•
•
•
NOT.
AND.
OR.
NAND.
NOR.
XOR (exclusive OR).
XNOR (exclusive NOR).
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Sequential Logic Devices
• Have outputs that depend on their
inputs as well as time.
• Require clock pulses.
• An inherent delay time is always
present.
• Flip-flop devices.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Sequential Logic Circuit
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Boolean Expressions
• Every gate logic function has its own
equation called a Boolean expression.
• Boolean algebra:
– Two states are true and false.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Boolean Expressions (Cont.)
• True state:
– Represented by the number one, called
logic high or logic one in Boolean
algebra.
• False state:
– Represented by the number zero, called
logic low or logic zero.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Boolean Expressions (Cont.)
• Logic high:
– Represented by the presence of a voltage
potential.
– Represented with five volts (+5 V).
• Logic low:
– Represented by the absence of a voltage
potential.
– Represented with zero volts (0 V).
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Truth Tables
• In Boolean algebra,
a table contains the
digital input and
output points.
• This table is called
a truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Gate Symbols
• For every combinational and sequential
logic device.
• Used to create logic gate circuits.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
NOT Gate
• Output is the
inverse of the input.
• Sometimes called
an inverter.
• Function is
simulated by the
electric circuit
displayed.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
AND Gate
• Two-input AND
logic gate symbol,
its Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
OR Gate
• Two-input OR logic
gate symbol, its
Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
NAND Gate
• Two-input NAND
logic gate symbol,
Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
NOR Gate
• A two-input NOR
logic gate symbol,
its Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
XOR (exclusive OR) Gate
• XOR logic gate
symbol, its Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
XNOR (exclusive NOR) Gate
• XNOR logic gate
symbol, its Boolean
expression, and its
truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Simplifying Boolean
Expressions
• To convert a truth table to a PLC
– Find its simplified Boolean expression.
– Use the gate logic to PLC ladder diagram
conversion routine to create the PLC
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Simplifying Boolean
Expressions (Cont.)
• Three methods used to simplify
Boolean expressions:
– Karnaugh maps.
– Quine-McCluskey routine.
– Electronic simulation software.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Karnaugh Maps (K-Map)
• Graphical representations of truth
tables.
– Use columns and rows to represent each
term in a truth table.
– For an n-variable input truth table, there
are 2n boxes in a Karnaugh map.
– A box for every line in the truth table.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Karnaugh Maps (K-Map)
(Cont.)
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps
•
Use the following steps to simplify the
Boolean expressions using K-Maps:
1. Select an appropriate K-Map that has the
correct number of input boxes, such as
two-input and three-input. As stated, for an
n-variable input truth table, there will be 2n
boxes. Therefore, for a two-variable (A and
B) input table, there will be 22 boxes, or 4
boxes.
2. Plot only the terms in which Y = 1.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
3. Follow the rules below for grouping the 1s in the
K-Map that lead to simplifying the expression.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
• Each group must contain an even number of
binary 1s.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
• Every 1 in adjacent cells must be included in a
group.
• The same 1 can be used in two or more
overlapping groups. Each group should be as large
as possible.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
• Map can be considered closed, so that end boxes
are grouped adjacently (top and bottom, or left and
right).
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
• How groups wrap around the K-Map.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
4. Write the Boolean expressions for each group, and
then simplify the expression.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Using K-Maps (Cont.)
5. Sum common variables from each group to create
simplified sum of product (SOP) Boolean
expression.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Quine-McCluskey Routine
• For more than five input variables, a
better method for simplifying Boolean
expressions.
• Complicated method that uses the
Boolean algebraic simplification rules
to find the simplified Boolean
expression.
• Might be used in an advanced course.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Electronic Simulation
Software
• Easiest method to find simplified
Boolean expression:
– Enter input and output data.
– Solves and simplifies the expression.
– NI Multisim is an example of this software.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
NI Multisim Software
• Open NI Multisim program.
• From the Instruments toolbar, click
the Logic Converter icon.
• Click a space in the work area to place
the converter.
• Double-click the Logic Converter
image to open the Logic Converter
dialog box.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Diagrams from Logic Gate Circuits
• Convert each gate to its equivalent
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
from Boolean Expressions
• Some manufacturers use Boolean
expressions to program PLCs.
Example
• Create the PLC ladder logic diagram
for the following Boolean expression.
Y = A′ + B + CD + EB
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
from Boolean Expressions (Cont.)
• To create the diagram, each rung or
each portion of a rung is created by
replacing the Boolean letter with the
inputs that match.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
from Boolean Expressions
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Creating Logic Gate Circuits from
• Converting to logic gate circuits:
– Find Boolean expression that represents
– Draw the logic gate circuit using the
Boolean expression similar.
– Use logic converter instrument in NI
Multisim program to find truth tables and
Boolean expressions.
&copy; Goodheart-Willcox Co., Inc.
Permission granted to reproduce for educational use only.
Creating Logic Gate Circuits from