INI3601
Study Guide
INDUSTRIAL INSTRUMENTS III
UNIT 5: PROCESS CONTROL SYSTEMS: PLCs & INTROUCTION TO
LADDER
UNIT 6: PROCESS CONTROL SYSTEMS: TIMERS & COUNTERS
Diploma in Electrical Engineering
In the Department of Electrical Engineering
School of Engineering
College of Science, Engineering & Technology (CSET)
University of South Africa
Compiled by: Dr. E.M. Migabo (PhD Computer Science & DEng Electrical Engineering)
Instructors: Dr. M.E. Migabo & Mr. A.M. Dlamini
May, 2023
INI3601
Study Guide
I. Learning objectives
• Understand the basic principles of unit process control systems and their applications in
industrial settings.
• Learn the fundamental concepts of programmable logic controllers (PLCs), including their
history, development, and functions.
• Understand the different types of PLCs and their architectures, including the different types
of I/O modules and communication protocols.
• Learn about the various types of sensors and actuators used in industrial control systems
and their interfacing with PLCs.
• Understand the basic concepts of ladder programming, including the different types of
instructions used in ladder diagrams.
• Learn how to create and interpret basic ladder diagrams for simple industrial control
systems.
• Understand the principles of PLC programming, including ladder logic design and
execution.
II. Unit summary
II.1. Part 1: Programmable Logic Controllers (PLCs) : An Overview
Chapter 1 of the book "Programmable Logic Controllers" by Frank Petruzella provides an
introduction to programmable logic controllers (PLCs) and their role in industrial automation. The
chapter sets the foundation for understanding the key concepts, components, and functions of
PLCs.
The chapter begins by highlighting the significance of PLCs in modern industrial control systems.
It emphasizes the need for automation in industries to improve productivity, efficiency, and
reliability. The author explains that PLCs are versatile devices used to control and monitor various
processes and machinery in industries such as manufacturing, power generation, and
transportation.
Next, the chapter explores the basic components of a typical PLC system. It describes the input
and output devices used to interface with the external environment, such as sensors and actuators.
The author explains how these devices communicate with the PLC through digital and analog
signals.
The book then delves into the internal architecture of a PLC, introducing concepts such as the
central processing unit (CPU), memory, and the input/output (I/O) section. The author explains
how the CPU executes control programs stored in memory and interacts with I/O devices to
monitor inputs and control outputs.
Furthermore, the chapter discusses the programming languages used in PLCs. It provides an
overview of ladder logic, function block diagrams, structured text, and other programming
languages commonly employed in PLC systems. The author emphasizes the importance of
selecting the appropriate programming language based on the specific application requirements.
2
INI3601
Study Guide
Additionally, the chapter covers the lifecycle of a typical PLC system, including stages such as
specification, design, installation, and maintenance. It highlights the need for thorough testing and
validation of PLC programs to ensure reliable operation.
In summary, Chapter 1 of "Programmable Logic Controllers" introduces readers to the world of
PLCs. It provides a comprehensive overview of their importance in industrial automation, the
components and architecture of a PLC system, programming languages, and the lifecycle of a PLC
project. This chapter serves as a foundation for understanding the subsequent chapters that delve
into more advanced topics related to PLCs.
II.2. Part 2: Basics of PLC Programming
Chapter 4 focuses on the basics of PLC programming. It introduces readers to the fundamental
concepts and techniques required to develop effective PLC programs.
The chapter starts by explaining the structure and layout of a typical PLC program. It discusses
the concept of ladder logic programming, which is widely used in PLC systems. Ladder logic
diagrams are presented as a graphical representation of relay logic circuits, making it easier for
users to understand and develop programs.
The author introduces various ladder logic symbols, such as contacts, coils, timers, counters, and
special relay instructions. These symbols form the building blocks of ladder logic programming
and are used to create complex control sequences.
The chapter then delves into the principles of input and output addressing. It explains how input
devices, such as sensors, are connected to the PLC's input modules, and output devices, such as
actuators, are connected to the PLC's output modules. The author demonstrates how to assign
addresses to input and output devices, allowing them to be accessed and controlled within the
program.
Next, the chapter covers basic ladder logic programming techniques. It discusses the concept of a
rung, which represents a logical statement in the ladder diagram. The author explains how to use
contacts, coils, and other ladder logic symbols to develop control logic for different industrial
applications.
The chapter also addresses the importance of documentation and comments in PLC programming.
It emphasizes the need for clear and concise documentation to aid in program understanding,
troubleshooting, and future modifications.
Throughout the chapter, the author provides examples and sample ladder logic programs to
illustrate the discussed concepts. These examples highlight the application of ladder logic symbols
and techniques in practical scenarios, making it easier for readers to grasp the programming
concepts.
In summary, Chapter 4 of "Programmable Logic Controllers" covers the basics of PLC
programming using ladder logic. It introduces the fundamental concepts, symbols, addressing
techniques, and programming techniques required to develop effective control programs.
3
INI3601
Study Guide
Although graphics would enhance the understanding of ladder logic, the text-based summary
provides a concise overview of the chapter's content.
II.3. Part 3: Timers and Counters
Chapters 5 and 6 of the book focus on timers and counters, two important functions in
programmable logic controllers (PLCs) used to control and monitor industrial processes. These
chapters provide a comprehensive understanding of the principles, types, and applications of
timers and counters in PLC programming.
Chapter 5 begins by introducing timers and their role in controlling time-based events. The author
explains the concept of timers as devices that measure and control time intervals within a PLC
program. Timers are commonly used in industrial applications to control processes such as timing
sequences, delays, and periodic operations.
The chapter covers various types of timers, including on-delay timers, off-delay timers, and
retentive timers. Each timer type is explained in detail, with examples and ladder logic diagrams
illustrating their functionality. The author emphasizes the importance of understanding the timing
characteristics and applications of different timer types to ensure accurate and reliable control.
Furthermore, the chapter delves into the programming techniques for timers. It explains how to
implement timers in ladder logic programming using contacts, coils, and auxiliary relay
instructions. The author provides step-by-step instructions and examples to demonstrate the proper
use of timers in controlling time-based events.
Chapter 6 shifts the focus to counters, which are used to track and count events or pulses in a PLC
system. The author begins by explaining the concept of counters and their applications in industrial
control. Counters are used to monitor and control processes that involve counting objects, parts,
or events, such as product packaging, batch production, and inventory control.
The chapter explores different types of counters, including up counters, down counters, and
special-purpose counters. It explains the functionality and programming techniques for each
counter type. Examples and ladder logic diagrams are provided to illustrate the implementation of
counters in PLC programs.
Additionally, the chapter covers advanced counting techniques such as cascading counters, where
multiple counters are connected in series or parallel to achieve complex counting operations. The
author explains the advantages and considerations associated with cascading counters, providing
practical insights into their application.
Throughout both chapters, the author emphasizes the importance of understanding timing and
counting requirements in industrial applications. Proper selection, configuration, and
programming of timers and counters are crucial for achieving accurate and efficient control of
time-based and counting operations.
The chapters also highlight troubleshooting techniques for timers and counters. The author
discusses common problems that may arise, such as incorrect timing or counting, and provides
guidance on how to diagnose and resolve these issues.
4
INI3601
Study Guide
In summary, Chapters 5 and 6 of "Programmable Logic Controllers" provide a comprehensive
understanding of timers and counters in PLC programming. These chapters cover the principles,
types, programming techniques, and troubleshooting considerations related to timers and counters.
By mastering these concepts, readers can effectively utilize timers and counters to control time-
based events and counting operations in various industrial applications.
II.4. Slides:
5
ELB1502
Part 1: Programmable Logic
Controllers (PLCs)
An Overview
Compiled by Dr. E.M. Migabo
Department of Electrical Engineering
e-mail:
[email protected] Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 1
Hill Education.
Learning Outcomes
By the end of part 1, you will be able to describe a PLC in
terms of hardware design, operation and application.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 2
Hill Education.
Assessment Criteria
• PLC is defined
• Advantages of a PLC are listed
• The hardware components of a PLC are listed
• PLC operation is described
• PLC hardware components are described in terms of their
functions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 3
Hill Education.
Assessment Criteria
• The PLC system diagram is drawn
• The difference between PLCs and Computers is explained
• The types of mechanical designs and sizes for PLC systems are
differentiated
• The different PLC Applications are discussed.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 4
Hill Education.
What is a PLC?
A programmable logic controller (PLC): is an industrial
grade computer that is capable of being programmed
to perform control functions.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 5
Hill Education.
PLC Advantages?
• Benefits include:
➢ Fast response and high control speed: PLCs are designed
for high-speed and real-time applications. The
programmable controller operates in real time, which
means that an event taking place in the field will result in
the execution of an operation or output.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 6
Hill Education.
PLC Advantages?
➢Increased Reliability. Once a program has been
written and tested, it can be easily downloaded to
other PLCs. Since all the logic is contained in the
PLC’s memory, there is no chance of making a
logic wiring error. The program takes the place of
much of the external wiring that would normally
be required for control of a process.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 7
Hill Education.
PLC Advantages?
➢More Flexibility. It is easier to create and change a
program in a PLC than to wire and rewire a circuit. With a
PLC the relationships between the inputs and outputs are
determined by the user program instead of the manner in
which they are interconnected.
➢ Lower Cost. PLCs were originally designed to replace relay
control logic, and the cost savings have been so significant
that relay control is becoming obsolete except for power
applications. Generally, if an application has more than
about a half-dozen control relays, it will probably be less
expensive to install a PLC.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 8
Hill Education.
PLC Advantages?
➢ Communications Capability. A PLC can communicate with
other controllers or computer equipment to perform such
functions as supervisory control, data gathering,
monitoring devices and process parameters, and
download and upload of programs
➢ Easier to Troubleshoot. PLCs have resident diagnostics and
override functions that allow users to easily trace and
correct software and hardware
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 9
Hill Education.
What is a PLC made of ?
A PLC consists of a CPU containing an application program and
I/O interface module, which is directly connected to field I/O
devices and the power supply.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 10
Hill Education.
PLC architecture
A typical PLC can be divided into parts, as illustrated in
the figure above.
The term architecture can refer to PLC hardware, to PLC
software, or to a combination of both.
• An open architecture design allows the system to be
connected easily to devices and programs made by other
manufacturers. Open architectures use off-the-shelf
components that conform to approved standards.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 11
Hill Education.
PLC architecture
• A system with a closed architecture is one whose design is
proprietary, making it more difficult to connect to other
systems. Most PLC systems are in fact proprietary, so you
must be sure that any generic hardware or software you may
use is compatible with your particular PLC.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 12
Hill Education.
Parts of a PLC System
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 13
Hill Education.
Parts of a PLC System
1. I/O interface module: There are two ways in which
I/Os (Inputs/Outputs) are incorporated into the PLC: fixed
and modular.
▪ Fixed I/O is typical of small PLCs that come in one
package with no separate, removable units. The processor
and I/O are packaged together, and the I/O terminals will
have a fixed number of connections built in for inputs and
outputs.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 14
Hill Education.
Parts of a PLC System
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 15
Hill Education.
Parts of a PLC System
The main advantage of this type of packaging is lower cost.
One disadvantage of fixed I/O is its lack of flexibility; you are
limited in what you can get in the quantities and types dictated
by the packaging. Also, for some models, if any part in the unit
fails, the whole unit has to be replaced.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 16
Hill Education.
Parts of a PLC System
▪ Modular I/O is divided by compartments into which
separate modules can be plugged. This feature greatly
increases your options and the unit’s flexibility.
You can choose from the modules available from the
manufacturer and mix them any way you desire.
The basic modular controller consists of a rack, power supply,
processor module (CPU), input/output (I/O modules), and an
operator interface for programming and monitoring.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 17
Hill Education.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 18
Hill Education.
Parts of a PLC System
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 19
Hill Education.
Parts of a PLC System
The modules plug into a rack. When a module is slid into the
rack, it makes an electrical connection with a series of contacts
called the backplane, located at the rear of the rack. The PLC
processor is also connected to the backplane and can
communicate with all the modules in the rack.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 20
Hill Education.
Parts of a PLC System
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 21
Hill Education.
Parts of a PLC System
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 22
Hill Education.
Parts of a PLC System
2. The power supply supplies DC power to other
modules that plug into the rack.
For large PLC systems, this power supply does not normally
supply power to the field devices. With larger systems, power to
field devices is provided by external alternating current (AC) or
direct current (DC) supplies. For some small micro PLC systems,
the power supply may be used to power field devices.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 23
Hill Education.
Parts of a PLC System
3. The Central Processing Unit(CPU): is the “brain”
of the PLC. A typical processor usually consists of a
microprocessor for implementing the logic and controlling
the communications among the modules. The processor
requires memory for storing user program instructions,
numerical values, and I/O devices status.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 24
Hill Education.
Parts of a PLC
4. A Programming device: is used to enter the desired
program into the memory of the processor.
➢ Programming language:
a) RLL (Relay ladder logic)
b) ST (Structured text):
c) High level language such as C
d) SFC (Sequential Function Chart)
e) FB (Function Block)
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 25
Hill Education.
Parts of a PLC
5. A Program: A program is a user-developed series of
instructions that directs the PLC to execute actions. A
programming language provides rules for combining the
instructions so that they produce the desired actions. Relay
ladder logic (RLL) is the standard programming language
used with PLCs. Its origin is based on electromechanical relay
control.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 26
Hill Education.
Parts of a PLC
The relay ladder logic program graphically represents rungs of
contacts, coils, and special instruction blocks. RLL was originally
designed for easy use and understanding for its users and has
been modified to keep up with the increasing demands of
industry’s control needs.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 27
Hill Education.
Principles of Operation
To get an idea of how a PLC operates, consider the simple
process control problem illustrated below.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 28
Hill Education.
Principles of Operation
▪ Here a mixer motor is to be used to automatically stir the
liquid in a vat when the temperature and pressure reach
preset values.
▪ In addition, direct manual operation of the motor is provided
by means of a separate pushbutton station.
▪ The process is monitored with temperature and pressure
sensor switches that close their respective contacts when
conditions reach their preset values.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 29
Hill Education.
Principles of Operation
This control problem can be solved using the relay method for
motor control shown in the relay ladder diagram below. The
motor starter coil (M) is energized when both the pressure and
temperature switches are closed or when the manual
pushbutton is pressed.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 30
Hill Education.
Principles of Operation
Now let’s look at how a programmable logic controller might be
used for this application.
The same input field devices (pressure switch, temperature
switch, and pushbutton) are used. These devices would be
hardwired to an appropriate input module according to the
manufacturer’s addressing location scheme. Typical wiring
examples illustrated below.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 31
Hill Education.
Principles of Operation
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 32
Hill Education.
Principles of Operation
The same output field device (motor starter coil) would also be
used. This device would be hardwired to an appropriate output
module according to the manufacturer’s addressing location
scheme. Typical wiring connections for a 120 VAC modular
configured output module are shown above.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 33
Hill Education.
Principles of Operation
Next, the PLC ladder logic program would be constructed
and entered into the memory of the CPU. A typical ladder logic
program for this process is shown here.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 34
Hill Education.
Principles of Operation
The CPU will constantly cycle through the program in the manner
depicted on the left and the PLC system altogether will generally
perform one additional step as shown on the right:
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 35
Hill Education.
Principles of Operation
The process control schemecan be described by the following
sequence of events:
✓ First, the pressure switch, temperature switch, and
pushbutton inputs are examined and their status is recorded
in the controller’s memory.
✓ A closed contact is recorded in memory as logic 1 and an open
contact as logic 0.
✓ Next the ladder diagram is evaluated, with each internal
contact given an OPEN or CLOSED status according to its
recorded 1 or 0 state.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 36
Hill Education.
Principles of Operation
✓ When the states of the input contacts provide logic continuity
from left to right across the rung, the output coil memory
location is given a logic 1 value and the output module
interface contacts will close.
✓ When there is no logic continuity of the program rung, the
output coil memory location is set to logic 0 and the output
module interface contacts will be open.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 37
Hill Education.
Principles of Operation
✓ The completion of one cycle of this sequence by the controller
is called a scan. The scan time, the time required for one full
cycle, provides a measure of the speed of response of the
PLC.
✓ Generally, the output memory location is updated during the
scan but the actual output is not updated until the end of the
program scan during the I/O scan.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 38
Hill Education.
Modifying the Operation
One of the important features of a PLC is the ease with which
the program can be changed. For example, assume that the
original process control circuit for the mixing operation must be
modified as shown in the relay ladder diagram of previously
illustrated.
The change requires that the manual pushbutton control be
permitted to operate at any pressure, but not unless the
specified temperature setting has been reached.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 39
Hill Education.
Modifying the Operation
If a relay system were used, it would require some rewiring
of the circuit to achieve the desired change. However, if a PLC
system were used, no rewiring would be necessary. The inputs
and outputs are still the same. All that is required is to change
the PLC ladder logic program.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 40
Hill Education.
PLCs vs Computers
The architecture of a PLC is basically the same as that of a
personal computer.
A personal computer (PC) can be made to operate as a
programmable logic controller if you provide a way for the
computer to receive information from devices such as push
buttons or switches. You also need a program to process the
inputs and some way to turn devices on and off. Additionally, it
will need to control the output devices as well.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 41
Hill Education.
PLCs vs Computers
However, some important characteristics distinguish PLCs from
personal computers.
▪ First, unlike PCs, the PLC is designed to operate in the
industrial environment with wide ranges of ambient
temperature and humidity. A well-designed industrial PLC
installation is not usually affected by the electrical noise
inherent in most industrial locations.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 42
Hill Education.
PLCs vs Computers
▪ Secondly, unlike the personal computer, the PLC is
programmed in relay ladder logic or other easily learned
languages.
▪ PLCs have dedicated and straight forward I/O interfacing
options.
▪ Lastly, the PLC comes with its specified programming
languages and manufacturer’s specific syntax built into its
memory and has no permanently attached keyboard, CD drive
(although some now have memory card slot), or monitor.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 43
Hill Education.
PLC Size
The criteria used in categorizing PLCs include functionality,
number of inputs and outputs, cost, and physical size.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 44
Hill Education.
PLC Size
Of these, the I/O count is the most important factor. In general,
the nano is the smallest size with less than 15 I/O points. This is
followed by micro types (15 to 128 I/O points), medium types
(128 to 512 I/O points), and large types (over 512 I/O points).
Matching the PLC with the application is a key factor in the
selection process.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 45
Hill Education.
PLC Size
• It is not advisable to buy a PLC system that is larger than
current needs dictate. However, future conditions should be
anticipated to ensure that the system is the proper size to fill
the current and possibly future requirements of an
application.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 46
Hill Education.
PLC Application
• There are three major types of PLC application:
– Single - ended
– Multitask
– Control management.
A single-ended or stand-alone PLC application involves one PLC
con-trolling one process This would be a stand-alone unit and
would not be used for communicating with other computers or
PLCs. The size and sophistication of the process being
controlled are obvious factors in determining which PLC to
select. The applications could dictate a large processor, but
usually this category requires a small PLC.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 47
Hill Education.
PLC Application
A multitask PLC application involves one PLC controlling several
processes. Adequate I/O capacity is a significant factor in this
type of installation.
In addition, if the PLC would be a subsystem of a larger process
and would have to communicate with a central PLC or computer,
provisions for a data communications network are also required.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 48
Hill Education.
PLC Application
A control management PLC application involves one
PLC controlling several others.
This kind of application requires a large PLC processor designed
to communicate with other PLCs and possibly with a computer.
The control management PLC supervises several PLCs by
downloading programs that tell the other PLCs what has to be
done. It must be capable of connection to all PLCs so that by
proper addressing it can communicate with any one it wishes to.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 49
Hill Education.
PLC Application
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 50
Hill Education.
PLC Application
NOTE: With the size comes different memory requirement for
every PLC:
Factors affecting the memory size needed for a particular
PLC installation include:
• Number of I/O points used
• Size of control program
• Data-collecting requirements
• Supervisory functions required
• Future expansion
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 51
Hill Education.
Programmable Logic
Controllers (PLCs)
An Overview
End of Part 1
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw- 52
Hill Education.
ELB1502
Part 2: Fundamentals of logic
Compiled by Dr. E.M. Migabo
Department of Electrical Engineering
e-mail:
[email protected] Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Learning Outcomes
By the end of part 2, you will be able to
describe and implement the binary
functions, understand Boolean algebra and
convert Boolean expressions into ladder
logic diagrams.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Assessment Criteria
▪ The binary concept is explained
▪ Binary functions are described
▪ Boolean Algebra is explained
▪ Logic gate circuits are derived from Boolean
expressions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Assessment Criteria
▪ Logic gate circuits are converted into Boolean
equations
▪ Programmed logic advantages over Hardwired logic
are outlined
▪ Ladder logic is introduced
▪ Parallelism between Ladder logic, Boolean equations
and logic gate circuits is established.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
The Binary Concept
The PLC, like all digital equipment, operates on the binary
principle. The term binary principle refers to the idea that many
things can be thought of as existing in only one of two states.
These states are 1 and 0.
The 1 and 0 can represent ON or OFF, open or closed, true or false,
high or low, or any other two conditions.
The key to the speed and accuracy with which binary information
can be processed is that there are only two states, each of which is
distinctly different. There is no in-between state so when
information is processed the outcome is either yes or no.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
The term Logic
• Logic is the ability to make decisions when one or more
different factors must be taken into account before an action
is taken. This is the basis for the operation of the PLC, where it
is required for a device to operate when certain conditions
have been met.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Why do logic gates
From the above definition, let's talk about logic gate.
• A logic gate is a circuit with several inputs but only one output
that is activated by particular combinations of input
conditions.
• This means that the two-state binary concept, applied to
gates, can be the basis for making decisions.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Why do logic gates
A logic gate is an elementary building block of a digital circuit.
Most logic gates have two inputs and one output. At any given moment,
every terminal is in one of the two binary conditions low (0) or high (1),
represented by different voltage levels.
The logic state of a terminal can, and generally does, change
often, as the circuit processes data. In most logic gates, the low
state is approximately zero volts (0 V), while the high state is
approximately five volts positive (+5 V).
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Why do logic gates
• Some small hand-held programmers have digital logic keys,
such as AND, OR, and NOT, which are programmed using
Boolean expressions. These are the 3 fundamental logic
functions.
• Each function has a rule that will determine the outcome and
a symbol that represents the operation.
For the purpose of this discussion, the outcome or output is called Y and the
signal inputs are called A, B, C, and so on. Also, binary 1 represents the
presence of a signal or the occurrence of some event, and binary 0
represents the absence of the signal or nonoccurrence of the event.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
AND primary gate
➢ is a device with two or more inputs and one output. The AND gate
output is 1 only if all inputs are 1.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
AND primary gate
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
OR primary gate
➢ is a device with two or more inputs and one output. The OR gate
output is 1 if one or more inputs are 1.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
OR primary gate
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
NOT primary gate
➢ is a device with one input and one output. The NOT output is 1 if
the input is 0. The output is 0 if the input is 1.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Notations
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Secondary gate
➢ These devices are termed a secondary gate as they contains two
or more primary gates.
- NAND gate: The output of a NAND gate is 1 whenever one or
more inputs are 0.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Secondary gate
- NOR gate: The output of a NOR gate is 0 whenever one or
more inputs are 1.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Secondary gate
➢ - XOR gate: The output of an XOR gate is HIGH whenever the two
inputs are different.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Secondary gate
- XNOR gate: The output of an XOR gate is HIGH whenever the
two inputs are different.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Boolean algebra
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Boolean algebra
Rules of Boolean algebra
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Exercise: Find equation for Y:
1. 2.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Hardwired Logic versus Programmed Logic
➢ Hardwired logic refers to logic control functions that are
determined by the way devices are electrically interconnected.
This are implemented using relays and relay ladder schematics.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Hardwired Logic versus Programmed Logic
The control scheme is drawn between two vertical supply lines. All
the components are placed between these two lines, called rails or
legs, connecting the two power lines with what look like rungs of a
ladder.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Hardwired Logic versus Programmed Logic
➢ Hardwired logic is fixed; it is changeable only by altering the way
devices are electrically interconnected. In contrast,
programmable control is based on the basic logic functions, which
are programmable and easily changed.
➢ The most common PLC language is ladder logic.
➢ The instructions used are the relay equivalent of normally open
(NO) and normally closed (NC) contacts and coils.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Hardwired Logic versus Programmed Logic
➢ Input conditions (symbols) connected from left to right, with the
symbol that represents the output at the far right.
- The symbols that represent the inputs are connected in series,
parallel, or some combination of the two to obtain the desired
logic.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Hardwired Logic versus Programmed Logic
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Relationship: Ladder logic program
and Logic gate circuit.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Relationship: Ladder logic program and logic
gate circuit
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Word Level Logic
Instructions.
➢ Most PLCs provide word-level logic instructions as part of their
instruction set.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Word Level Logic
Instructions.
➢ This instruction tells the processor to perform an AND operation
on B3:5 and B3:7 and to store the result in destination B3:10
when input device A is true. The destination bits are a result of
the logical AND operation.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How Do You?
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Fundamentals of logic
End of Part 2
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
ELB1502
Part 3: Basics of PLC Programming
Compiled by Dr. E.M. Migabo
Department of Electrical Engineering
e-mail:
[email protected] Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Learning Outcomes
By the end of part 3, you will be able to identify the functions of
a PLC memory map and implement BASIC ladder logic
instructions diagrams.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Assessment Criteria
• Processor Memory Organization is described
• The following terms are defined:
– PLC cycle
– Mass I/O copying sequence
• PLC response time factors are listed
• Mass I/O copying sequence steps are listed
• PLC programming languages are listed and explained
• Bit-level logic instructions are described
• PLC addressing and Instructions addressing are explained
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Assessment Criteria
• Ladder logic is defined
• Ladder logic rules are listed
• Ladder logic symbols are drawn appropriately
• Branching Instructions are described and implemented
• Latching is defined and implemented
• Internal relays are defined and implemented
using PLC programming languages
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Assessment Criteria
• Difference is made between internal and external relays
• Ladder logic is implemented
• If Closed and If Opened Instructions re-examined
• Programming of analog devices is explained and
implemented
• Ladder Logic program are entered into the PLC
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
• Memory organization takes into account the way a PLC divides
the available memory into different sections. The memory
space can be divided into two broad categories: program files
and data files.
• Program files are the part of the processor memory that
stores the user ladder logic program. The program accounts
for most of the total memory of a given PLC system.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
• The data files store the information needed to carry out the
user program. This includes information such as the status of
input and output devices, timer and counter values, data
storage, and so on.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
❑ Program Files
Program files are the areas of processor memory where ladder
logic programming is stored. They may include:
• System functions (file 0)—This file is always included and
contains various system-related information and user-
programmed information such as processor type, I/O
configuration, processor file name, and password.
• Reserved (file 1)—This file is reserved by the processor and is
not accessible to the user.
• instructions residing in the main ladder program file
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
• Reserved (file 1)—This file is reserved by the processor and is
not accessible to the user.
• Main ladder program (file 2)—This file is always included and
contains user-programmed instructions that define how the
controller is to operate.
• Subroutine ladder program (files 3–255)—These files are
user-created and are activated according to subroutine
instructions residing in the main ladder program file
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
❑ Data Files
• The data file portion of the processor’s memory stores input
and output status, processor status, the status of various bits,
and numerical data. All this information is accessed via the
ladder logic program.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
These files are organized by the type of data they contain and
may include:
• Output (file 0)—This file stores the state of the output
terminals for the controller.
• Input (file 1)—This file stores the status of the input terminals
for the controller.
• Status (file 2)—This file stores controller operation
information and is useful for troubleshooting controller and
program operation.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
• Bit (file 3)—This file is used for internal relay logic storage.
• Timer (file 4)—This file stores the timer accumulated and
preset values and status bits.
• Counter (file 5)—This file stores the counter accumulated and
preset values and status bits.
• Control (file 6)—This file stores the length, pointer position,
and status bit for specific instructions such as shift registers
and sequencers.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Processor memory organization
• Integer (file 7)—This file is used to store whole number values
or bit information.
• Float (file 8)—The floating point file is used to store fractional
numerical data or numerical values greater than 32,767. This
file applies to selected PLC processors
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
The time it takes to complete a scan cycle is called the scan cycle
time and indicates how fast the controller can react to changes in
inputs.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
The scan time is a function of the following:
• The speed of the processor module
• The length of the ladder program
• The type of instructions executed
• The actual ladder true/false conditions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
For each rung executed, the PLC processor will:
• Step 1: Update the input by sensing the voltage of the input
terminals. Based on the absence or presence of a voltage, a 0
or a 1 is stored into the memory bit location designated for a
particular input terminal.
• Step 2: Solve the ladder logic in order to determine logical
continuity. If the conditions controlling an output are met, the
processor immediately writes a 1 in its memory location,
indicating that the output will be turned ON; conversely, if the
conditions are not met a 0 indicating that the device will be
turned OFF is written into its memory location.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
• Step 3: The final step of the scan process is to update the
actual states of the output devices by transferring the output
table results to the output module, thereby switching the
connected output devices ON (1) or OFF (0)
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Program Scan
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages
• Ladder Diagram (LD)—a symbolic depiction of instructions arranged
in rungs similar to ladder formatted schematic diagrams.
• Function Block Diagram (FBD)—a graphical depiction of process
flow using simple and complex interconnecting blocks.
• Sequential Function Chart (SFC)—a graphical depiction of
interconnecting steps, actions, and transitions.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages
• Instruction List (IL)—a low-level, text-based language that uses
mnemonic instructions.
• Structured Text (ST)—a high-level, text-based language such as
BASIC, C, or PASCAL specifically developed for industrial control
applications.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages types
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages types
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages types
Ladder diagram vs Function Block diagram vs Instruction List
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages types
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
PLC Programming Languages types
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
The ladder diagram language is basically a symbolic set of
instructions used to create the controller program.
Bit-level symbolic instructions fall into two separate categories:
instructions that examine data and instructions that control data.
Each symbolic instruction is a command to perform a specific
operation. These ladder instruction symbols are arranged to
obtain the desired control logic that is to be entered into the
memory of the PLC.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
Representations of contacts and coils are the basic symbols of the
logic ladder diagram instruction set.
The three fundamental symbols that are used to translate relay
control logic to contact symbolic logic are Examine If Closed (XIC),
Examine If Open (XIO), and Output Energize (OTE). Each of these
instructions relates to a single bit of PLC memory that is specified
by the instruction’s address.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
While the XIO and XIC are represented by symbols that resemble a
normally-open and normally-closed relay contact, they do not
operate like relay contacts. Instead, they operate as commands
that examine the value (0 or 1) of a bit of data to determine its
true or false logical condition.
The symbol for the Examine If Closed (XIC) instruction is shown in
Figure 5-20. The XIC instruction is also called the Examine-on
instruction.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
This represents a NO: Normally Open contact
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
Associated with each XIC instruction is a memory bit linked to
the status of an input device or an internal logical condition in a
rung. This instruction asks the PLC’s processor to examine if the
contact is closed.
It does this by examining the bit at the memory location
specified by the address in the following manner:
• The memory bit is set to 1 or 0 depending on the status of
the input (physical) device or internal ( logical) relay
address associated with that bit.
• A 1 corresponds to a true status or on condition.
• A 0 corresponds to a false status or off condition.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
• When the Examine-on instruction is associated with a
physical input, the instruction will be set to 1 when a
physical input is present (voltage is applied to the input
terminal), and 0 when there is no physical input present
(no voltage applied to the input terminal).
• When the Examine-on instruction is associated by
address with an internal relay, then the status of the bit is
dependent on the logical status of the internal bit with
the same address as the instruction.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
• If the instruction memory bit is a 1 (true) this instruction
will allow rung continuity through itself, like a closed relay
contact.
• If the instruction memory bit is a 0 (false) this instruction
will not allow rung continuity through itself and will
assume a normally open state just like an open relay
contact.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
NO (Normally Open) vs NC (Normally Closed)
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
The XIO instruction, which is also called the Examine-off
instruction, looks and operates like a normally closed relay
contact. Associated with each XIO instruction is a memory bit
linked to the status of an input device or an internal logical
condition in a rung.
This instruction asks the PLC’s processor to examine if the
contact is open. It does this by examining the bit at the memory
location specified by the address in the following manner:
• As with any other input the memory bit is set to 1 or 0
depending on the status of the input (physical) device or
internal (logical) relay address associated with that bit.
• A 1 corresponds to a true status or on condition.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
• A 0 corresponds to a false status or off condition.
• When the Examine-off instruction is used to examine a
physical input, then the instruction will be interpreted as
false when there is a physical input (voltage) present (the
bit is 1) and will be interpreted as true when there is no
physical input present (the bit is 0).
• If the Examine-off instruction were associated by address
with an internal relay, then the status of the bit would be
dependent on the logical status of the internal bit with
the same address as the instruction.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
• Like the Examine-on instruction, the status of the
instruction (true or false) determines if the instruction
will allow rung continuity through itself, like a closed
relay contact.
• The memory bit always follows the status (true 5 1 or
false 5 0) of the input address or internal address
assigned to it. The interpretation of that bit, however, is
determined by which instruction is used to examine it.
• Examine-on instructions always interpret a 1 status as
true and a 0 status as false, while Examine-off
instructions interpret a 1 status as false and a 0 status as
true, as illustrated in Figure 5-22.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
NO and NC in a program
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
The symbol for the Output Energize (OTE) instruction is shown
in Figure 5-23. The OTE instruction looks and operates like a
relay coil and is associated with a memory bit.
This instruction signals the PLC to energize (switch on) or de-
energize (switch off ) the output.
The processor makes this instruction true (analogous to
energizing a coil) when there is a logical path of true XIC and
XIO instructions in the rung.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
The operation of the Output Energize instruction can
be summarized as follows:
• The status bit of the addressed Output Energize
instruction is set to 1 to energize the output and to 0 to
de-energize the output.
• If a true logic path is established with the input
instructions in the rung, the OTE instruction is energized
and the output device wired to its terminal is energized.
• If a true logic path cannot be established or rung
conditions go false, the OTE instruction is de-energized
and the outputPetruzella,
device wired
F., 2017. to itLogic
Programmable is switched off.
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
• If a true logic path cannot be established or rung
conditions go false, the OTE instruction is de-energized
and the output device wired to it is switched off.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Bit-Level Logic Instructions graphical
explanation
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Interaction with field devices
Sometimes beginner programmers who are used to thinking in
terms of hardwired relay control circuits tend to use the same
type of contact (NO or NC) in the ladder logic program that
corresponds to the type of field switch wired to the discrete
input.
While this is true in many instances, it is not the best way to
think of the concept.
A better approach is to separate the action of the field device
from the action of the PLC bits as illustrated in Figure 5-24.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Interaction with field devices
A signal present makes the NO bit (1) true; a signal absent
makes the NO bit (0) false. The reverse is true for an NC bit. A
signal present makes the NC bit (1) false; a signal absent
makes the NC bit (0) true.
The main function of the ladder logic diagram program is to
control outputs based on input conditions, as illustrated in
Figure 5-25. This control is accomplished through the use of
what is referred to as a ladder rung. In general, a rung consists
of a set of input conditions, represented by contact
instructions, and an output instruction at the end of the rung,
represented by the coil symbol.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Interaction with field devices
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How the code is interpreted by the PLC
Each contact or coil symbol is referenced with an address that
identifies what is being evaluated and what is
being controlled.
The same contact instruction can be used throughout the
program whenever that condition needs to be evaluated.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How the code is interpreted by the PLC
While this is true for the XIO and XIC contact instructions, the
same cannot be said for the OTE coil instruction.
A common mistake for the novice programmer is to place the
same addressed OTE instruction on multiple rungs within the
same program.
This practice is to be avoided since it will lead to unpredictable
program outcomes. The number of ladder logic relays
and input and output instructions is limited only by
memory size.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How the code is interpreted by the PLC
Most PLCs allow more than one output per rung. For an output
to be activated or energized, at least one left-to-right true
logical path must exist, as illustrated in Figure 5-26.
A complete closed path is referred to as having logical
continuity. When logical continuity exists in at least one path,
the rung condition and Output Energize instruction are said to
be true.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How the code is interpreted by the PLC
The rung condition and OTE instruction are false if no logical
continuity path has been established.
During controller operation, the processor evaluates the rung
logic and changes the state of the outputs according to the
logical continuity of rungs.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
How the code is interpreted by the PLC
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Branch instructions are used to create parallel paths of input
condition instructions. This allows more than one combination
of input conditions (OR logic) to establish logic continuity in a
rung.
Input branching: by formation of parallel branches can be used
in your application program to allow more than one
combination of input conditions.
If at least one of these parallel branches forms a true logic
path, the rung logic is true and the output will be energized.
If none of the parallel branches complete a logical path, logic
rung continuity is not established and the output will be de-
energized.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
In the example shown in Figure 5-30 above, either A and B, or
C provides logical continuity and energizes output D.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
On most PLC models, branches can be established at both
input and output portions of a rung.
With output branching, you can program parallel outputs on a
rung to allow a true logic path to control multiple outputs,
as illustrated in Figure 5-31.
When there is a true logic rung path, all parallel outputs
become true. In the example shown, either A or B provides a
true logical path to all three output instructions: C, D, and E.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Additional input logic instructions (conditions) can
be programmed in the output branches to enhance
conditional control of the outputs. When there is a true logic
path, including extra input conditions on an output branch,
that branch becomes true.
In the example shown in Figure 5-32, either A and D or B and
D provide a true logic path to E. Input and output branches
can be nested to avoid redundant instructions and to speed
up processor scan time.
Figure 5-33 illustrates nested input and output branches. A
nested branch starts or ends within another branch.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
In some PLC models, the programming of a branch circuit within
a branch circuit or a nested branch cannot be done directly. It is
possible, however, to program a logically equivalent branching
condition.
Figure 5-34 below shows an example of a circuit that contains a
nested contact D. To obtain the required logic, the circuit would
be programmed as shown in Figure 5-35. The duplication
of contact C eliminates the nested contact D.
Nested branching can be converted into non-nested branches by
repeating instructions to make parallel equivalents.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Input branching: by formation of parallel branches can be used in your application
program to allow more than one combination of input conditions. If at least one of these
parallel branches forms a true logic path, the rung logic is true and the output will be
energized. If none of the parallel branches complete a logical path, logic rung continuity is
not established and the output will be de-energized.
Example:
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Some PLC manufacturers have virtually no limitations on
allowable series elements, parallel branches, or outputs.
For others, there may be limitations to the number of
series contact instructions that can be included in one rung of a
ladder diagram as well as limitations to the
number of parallel branches.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Also, there is an additional limitation with some PLCs: only one
output per rung and the output must be located at the end of the
rung. The only limitation on the number of rungs is memory size.
Figure 5-36 shows the matrix limitation diagram for a typical PLC. A
maximum of seven parallel lines and 10 series contacts per rung is
possible.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Another limitation to branch circuit programming is that the PLC
will not allow for programming of vertical contacts.
A typical example of this limitation is contact C of the user program
drawn in Figure 5-37. To obtain the required logic, the circuit would
be reprogrammed as shown in Figure 5-38.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
The processor examines the ladder logic rung for logic continuity
from left to right only. The processor never allows for flow from
right to left.
This situation presents a problem for user program circuits similar
to that shown in Figure 5-39.
If programmed as shown, contact combination FDBC would be
ignored. To obtain the required logic, the circuit would be
reprogrammed as shown in Figure 5-40.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Branching Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Internal Relay Instructions
Most PLCs have an area of the memory allocated for what are
known as internal storage bits. These storage bits are also called
internal outputs, internal coils, internal control relays, or simply
internal bits.
• These are variables within a code:
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Internal Relay Instructions
Internal outputs are on/off signals generated by
programmed logic.
Unlike a discrete output, an internal output does not directly
control an output field device. The internal output operates
just like any output that is controlled by programmed logic;
however, the output is used strictly for internal purposes.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Internal Relay Instructions
The advantage of using internal outputs is that there are many
situations in which an output instruction is required in a
program but no physical connection to a field device is
needed.
Internal storage bits or points can be programmed by the user
to perform relay functions without occupying a physical
output.
In this way internal outputs can minimize output module point
requirements whenever practical.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Internal Relay Instructions
Internal outputs are single-bit storage locations in memory and
are addressed as such.
Siemens S7-1200 controllers use bit file M for storage and
addressing of internal output bits. The addressing for bit
M0.0 consists of the byte number followed by bit numbers.
This is the same principle as the input (I) and output (Q)
addressing one.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
A simple program using the Examine If Closed (XIC) instruction is
shown in Figure 5-43.
This figure shows a hardwired circuit and a user program that
provides the same results. You will note that both the NO and
the NC pushbuttons are represented by the Examine If
Closed symbol.
This is because the normal state of an input (NO or NC) does not
matter to the controller.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
What does matter is that if contacts need to close to energize
the output, then the Examine If Closed instruction is used.
Since both PB1 and PB2 must be closed to energize the pilot
light, the Examine If Closed instruction is used for both.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
A simple program using the Examine If Open (XIO) instruction is
shown in Figure 5-44.
Both the hardwired circuit and user program are shown.
In the hardwired circuit, when the pushbutton is open relay coil
CR is de-energized and its NO contact closes to switch the pilot
light on.
When the pushbutton is closed, relay coil CR is energized and its
NC contact opens to switch the pilot light off.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
The pushbutton is represented in the user program by an
Examine If Open instruction.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
This is because the rung must be true when the external
pushbutton is open and false when the pushbutton is closed.
Using an Examine If Open instruction to represent the
pushbutton satisfies these requirements.
The NO or NC mechanical action of the pushbutton is not a
consideration. It is important to remember that the user
program is not an electrical circuit but a logic circuit.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
In effect, we are interested in logic continuity when establishing
an output. Figure 5-45 shows a simple program using both
the XIC and XIO instructions.
The logic states (0 or 1) indicate whether an instruction is true
or false and is the basis of controller operation. The figure
summarizes the on/off state of the output as determined by the
changing states of the inputs in the rung.
The time aspect relates to the repeated scans of the program,
wherein the input table is updated with the most current status
bits.
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Programming Examine If Closed and
Examine If Open Instructions
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
Basics of PLC Programming
End of Part 3
Petruzella, F., 2017. Programmable Logic
Controllers. 5th ed. New York, NY: McGraw-
Hill Education.
INI3601
Study Guide
III. Tutorials
1. Q: What is the purpose of a programmable logic controller (PLC) in industrial automation? A: The
purpose of a PLC in industrial automation is to control and monitor various processes and
machinery in industries such as manufacturing, power generation, and transportation. It improves
productivity, efficiency, and reliability by automating tasks that were previously performed
manually.
2. Q: What are the basic components of a typical PLC system? A: A typical PLC system consists of
three basic components: input devices, output devices, and a central processing unit (CPU). Input
devices, such as sensors, provide signals to the PLC, while output devices, such as actuators,
receive signals from the PLC. The CPU executes control programs and coordinates the
communication between input and output devices.
3. Q: What are the common programming languages used in PLCs? A: The common programming
languages used in PLCs include ladder logic, function block diagrams, structured text, and
instruction lists. Ladder logic is widely used and resembles relay logic diagrams, making it easier
for users familiar with traditional control systems to understand and program PLCs.
4. Q: Why is thorough testing and validation of PLC programs important? A: Thorough testing and
validation of PLC programs are important to ensure the reliable operation of industrial processes.
Testing helps identify and resolve programming errors, logic faults, or hardware issues before
deploying the PLC system in a live production environment. Validation confirms that the PLC
system meets the desired performance and functional requirements.
5. Q: What is ladder logic programming, and why is it commonly used in PLC systems? A: Ladder
logic programming is a graphical programming language widely used in PLC systems. It
resembles relay logic circuits and allows users to create control sequences using ladder diagram
symbols. Ladder logic is intuitive, easy to understand, and enables users to design and troubleshoot
programs effectively.
6. Q: What are contacts and coils in ladder logic programming? A: Contacts in ladder logic represent
the status of input devices, such as switches or sensors. They can be normally open (NO) or
normally closed (NC). Coils, on the other hand, represent output devices, such as actuators or
relays. They control the energization of output devices based on the status of contacts.
7. Q: How are timers implemented in ladder logic programming? A: Timers in ladder logic
programming are implemented using timer instructions, such as on-delay timers, off-delay timers,
or retentive timers. By using contacts, coils, and auxiliary relay instructions, timers can be
activated, monitored, and used to control time-based events and delays in a PLC program.
8. Q: What is the purpose of documentation and comments in PLC programming? A: Documentation
and comments play a vital role in PLC programming. Documentation provides a clear and concise
record of the program's purpose, structure, and functionality. Comments serve as annotations
within the program, explaining the logic, providing insights, or acting as reminders. Both
documentation and comments aid in program understanding, troubleshooting, and future
modifications.
9. Q: How does input and output addressing work in PLC programming? A: In PLC programming,
input and output addressing refers to the assignment of unique addresses to input and output
devices connected to the PLC system. These addresses enable the PLC to identify and
communicate with specific devices. Input addresses are used to monitor the status of input devices,
while output addresses control the activation of output devices within the program.
6
INI3601
Study Guide
Chapter 5: Timers
1. Q: What is the purpose of using timers in PLC programming? A: Timers are used in PLC
programming to control time-based events, such as delays, timing sequences, and periodic
operations. They allow for precise timing control and coordination of industrial processes.
2. Q: What are the different types of timers commonly used in PLC systems? A: The common types
of timers used in PLC systems include on-delay timers, off-delay timers, and retentive timers.
Each type has its own characteristics and applications in controlling time-based events.
3. Q: How are on-delay timers implemented in ladder logic programming? A: On-delay timers in
ladder logic programming are implemented using timer contacts and coils. The timer contact starts
counting when the associated input condition becomes true, and the timer coil activates the output
after the preset time has elapsed.
4. Q: How can timers be cascaded in PLC programming? A: Timers can be cascaded by using the
done output of one timer as the enable input for another timer. This allows for sequential timing
operations and more complex control sequences.
Chapter 6: Counters
5. Q: What is the purpose of using counters in PLC programming? A: Counters in PLC programming
are used to track and count events or pulses. They are commonly used in applications such as
product packaging, batch production, and inventory control.
6. Q: What are the different types of counters commonly used in PLC systems? A: The common
types of counters used in PLC systems include up counters, down counters, and special-purpose
counters. Each type has its own functionality and application in counting operations.
7. Q: How are up counters implemented in ladder logic programming? A: Up counters in ladder logic
programming are implemented using counter contacts and coils. The counter contact detects the
input condition, and the counter coil increments the count value. When the count reaches the preset
limit, the counter coil activates the output.
8. Q: What are the considerations when using cascaded counters? A: When using cascaded counters,
it is important to ensure that the enable output of one counter is connected to the enable input of
the next counter in the sequence. Additionally, the preset values and reset conditions of each
counter must be properly configured for accurate counting operations.
9. Q: How can counters be used for complex counting operations? A: Counters can be cascaded or
combined with other control instructions, such as timers or comparators, to perform complex
counting operations. This allows for the implementation of more advanced control logic in PLC
programming.
10. Q: Why is proper testing and validation important when using timers and counters in PLC
programming? A: Proper testing and validation of timers and counters ensure their accurate and
reliable operation. Thorough testing helps identify and resolve programming errors or logic faults,
ensuring that the timers and counters function as intended in controlling time-based events and
counting operations.
7
INI3601
Study Guide
IV. Exercises and problems:
Chapter 4: Ladder Logic Programming
1. Exercise: Create a ladder logic program that turns on a motor when a start button is pressed and
keeps it running until a stop button is pressed. Include appropriate feedback indicators.
2. Problem: Design a ladder logic program that controls a traffic signal with red, yellow, and green
lights. The lights should change according to a predetermined timing sequence.
3. Exercise: Implement a ladder logic program that controls a conveyor belt. When a product is
detected at the input sensor, the belt should start moving, and after a specified time, the product
should be ejected at the output.
4. Problem: Develop a ladder logic program for a pump control system. The pump should turn on
when the liquid level in a tank falls below a certain threshold and turn off when it reaches a
specified high level.
Chapter 5: Timers
5. Exercise: Create a ladder logic program that activates a warning buzzer for 10 seconds whenever
a fault condition is detected in a machine. The buzzer should turn off automatically after the
specified time.
6. Problem: Design a ladder logic program for a traffic light intersection. Use timers to control the
duration of the green, yellow, and red lights for each direction.
7. Exercise: Implement a ladder logic program that controls an automated watering system. When a
moisture sensor detects dry soil, a water pump should be activated for a specific duration before
turning off.
Chapter 6: Counters
8. Exercise: Create a ladder logic program that counts the number of products passing on a
conveyor belt and displays the count on a digital display. Reset the counter after reaching a
certain limit.
9. Problem: Develop a ladder logic program for a batch production system. The program should
count the number of products required for a batch and activate an alarm when the target count is
reached.
10. Exercise: Implement a ladder logic program that controls a packaging machine. The program
should count the number of items to be packaged and stop the machine after a specific quantity
has been reached.