5. Course Contents
1. Introduction and Review
2. Internal Construction of the PLC
3. Sequential Control Systems
4. Input / Output Devices
5. PLC Networks and Hardwiring
6. 6. Programming of the PLC
7. Internal Relays
8. Timers
9. Counters
10. Shift Registers
8. Control System Task
• The main task of a control system is to
control a sequence of events or maintain
some variable constant or follow some
prescribed change.
• The inputs to such control systems
might come from switches or sensors,
however the outputs of the controller
might go to run a motor in order to move
an object, or to turn a valve, or perhaps
some heater on or off.
9. • In the traditional form of control systems,
the governing rules and the control actions
depend on the wiring of the control circuit.
• When changing the rules used for giving the
control actions, the wiring has to be
changed too. This leads to expensive cost
of replacing the controllers.
• Instead of hardwiring each control circuit
for each control rule or action, the basic
system for all situations can be used with a
microprocessor based controller.
10. • So, by changing the program instructions, the
same control circuit may be used with a wide
variety of control rules or actions, which
saves the cost.
• This was the main idea behind inventing the
programmable logic controllers (PLC).
• The PLC was invented in response to the
needs of the automotive manufacturing
industry where software revision replaced the
re-wiring of hard-wired control panels when
production models changed.
11. • Before the PLC, control, sequencing, and
safety interlock logic for manufacturing
automobiles was accomplished using
hundreds or thousands of relays, cam timers,
and drum sequencers and dedicated closed-
loop controllers.
• The process for updating such facilities for
the yearly model change-over was very time
consuming and expensive, as the relay
systems needed to be rewired by skilled
electricians.
12. • In the late 1960's PLCs were first introduced.
• The primary reason for designing such a
device, as mentioned before, was eliminating
the large cost involved in replacing the
complicated relay based machine control
systems.
• Bedford Associates proposed something
called a Modular Digital Controller (MODICON)
to a major car manufacturer.
13. • Other companies at the time proposed
computer based schemes, one of which was
based upon the PDP-8.
• The MODICON 084 brought the world's first
PLC into commercial production.
• These new controllers also had to be easily
programmed by maintenance and plant
engineers.
• The lifetime had to be long and programming
changes easily performed. They also had to
survive the harsh industrial environment
14. • In the mid 70's the dominant PLC technologies
were sequencer state-machines and the bit-
slice based CPU.
• The AMD 2901 and 2903 were quite popular in
MODICON and A-B PLCs.
• As conventional microprocessors evolved,
larger and larger PLCs were being based upon
them.
• Communications abilities began to appear in
approximately 1973. The first such system
was MODICON's MODBUS.
15. • The 80's saw an attempt to standardize
communications with General Motor's
manufacturing automation protocol (MAP).
• It was also a time for reducing the size of the
PLC and making them software programmable
through symbolic programming on personal
computers instead of dedicated programming
terminals or handheld programmers.
• Today the world's smallest PLC is about the
size of a single control relay.
16. • The 90's have seen a gradual reduction in
introducing new protocols, and modernization
of the physical layers of some of the more
popular protocols that survived the 1980's.
• The latest standard (IEC 1131-3) has tried to
merge PLC programming languages under one
international standard.
• We now have PLCs that are programmable in
function block diagrams, instruction lists, C
and structured text, at the same time PC's are
also being used to replace PLCs in some
applications.
20. 1. Rack or mounting part.
2. Processor or central processing
unit (CPU).
3. Input assembly.
4. Output assembly.
5. Power supply.
6. Programming unit.
37. Input/Output Unit
• The input/output unit provides the interface
between the PLC system and the outside
world allowing the connections to be made
through input/output channels to input
devices such as sensors or output devices
such as motors and solenoids.
• The input/output provides isolation and
signal conditioning.
38. Electrical isolation from the external world is
usually done by means of optoisolators or
optocouplers whose circuitry is displayed :
Light emitting photo
diode transistor
Optoisolator
40. • The signal isolation enables supplying
the input channels of the PLCs with a
wide range of input signals.
• The range of input signals might be :
5 V , 24 V , 110 V and 240 V in the
form of ON/OFF or digital / discrete
signals.
41. Input
channel
5 V
24 V
110 V
240 V
To input/output unit
5 volt digital
signal level
Input signal level of a PLC
42. Output are often specified to be in
one of the following forms :
1. Relay type.
2. Transistor type.
3. Triac type.
43. Relay Type
• In such a type, the output signal from the
PLC operates a relay which switches
small current in the external circuit and
isolates the PLC from the external circuit
that having larger currents.
• Since the relay outputs are relatively
slow, thus it would be suitable for A.C
and D.C switching.
45. Transistor Type
• In such a type, a transistor is to be used to
switch current in the external circuit.
• This type of output gives faster switching and
being restricted to the D.C switching.
• It is destroyed by over currents or high
reverse voltages therefore; a protection is
used in the form of either a fuse or a built-in
electronic protection.
• Also, the optoisolators are used to provide the
essential isolation.
48. Triac Type
• Such type can be used with optoisolators
to control the external loads which are
connected to an A.C power supply.
• So, such type is strictly being used with
A.C and must be protected by fuses
against over currents.
49.
50. 24 V, 100mA
240 V, 1A, A.C
240 V, 2A, A.C
Output
channel
110 V, 1A, A.C
from input/output unit
5 volt digital
PLC output levels
52. Continuous Control
• In continuous control systems the inputs
are sending information into the system
all the time and the outputs of the
system are being controlled all the time.
• A change to the input leads directly to a
change in the output.
• An example of this kind of system is a
security floodlight that comes on in the
dark.
53.
54. Sequential Control
In a sequential control system a
series of different events takes
place one after the other.
The finishing of one event in the
sequence provides the signal for the
next event to start.
55. Examples of sequential systems :
1. The timers that control
central heating systems.
2. Washing machines.
3. Traffic lights.
4. Lifts in buildings
57. Sometimes one of the events in the
sequence is itself a continuous control
system. For example, filling a washing
machine with water uses a continuous
control system that monitors the water
level and controls the water input valves.
58. However this is only one event in the series of
events that makes up the complete sequential
control system for the washing machine. It
will be started by the event that comes before
it and, when the machine is full, it will start
the next event off.
59. Conventional sequential control systems
usually adopt a centralized control approach,
and usually being implemented using
programmable controllers (PLCs).
This results in a wiring layout that becomes
complex as the number of devices increases
where complex bundles of wires are always
seen in PLC control systems due to the point-
to-point connections from all the I/O devices
to the PLC.
60. Types of Sequential Systems
1. Asynchronous systems.
2. Synchronous systems.
3. Mixed systems.
61. Asynchronous Systems
Such systems are event-based, which
means that a control action begins only
after the previous control action is
successfully completed.
In an asynchronous control system all of
the events in the sequence take place as
a result either due to an external event or
because the previous event has finished,
regardless of the time taken.
62. Asynchronous systems require sensors to detect
the completion of an event or an outside event and
so must be closed loop.
The control system for a lift is asynchronous where
the sequence of events depends entirely on
external events (people pressing the call buttons
outside the lift, and the floor buttons inside it) or
the completion of lift movements (the lift stops
moving, and the doors are opened, when a switch
detects that a floor has been reached).
64. Synchronous Systems
These systems are time-based, that
is, the system is driven by a clock
producing pulses at fixed intervals.
These pulses trigger the sequence of
control actions.
In a fully synchronous control system
all of the events in the sequence take
place at set points in time,
regardless of any external change.
65. Synchronous control systems are
used where the control of a
sequence of events must take place
at pre-set time intervals.
Such a system doesn’t take any
account of events outside it, only the
time between events is important.
Therefore it doesn’t need any
sensors; it is an open loop control
system.
66. Central heating timers are synchronous
controllers where the points at which the
heating and hot water systems are turned
on and off are fixed in time.
It should be noticed that, although once the
heating or hot water is turned on, that part
of the sequence is usually a continuous
system where temperature is continuously
monitored to control the heating system.
68. Mixed Systems
In most real sequential control systems
there is a mixture of synchronous and
asynchronous control. For example :
• Modern traffic light sets.
• A car burglar alarm.
• An automatic car park barrier.
• A microwave oven.
• A dishwasher
• A time lock on a bank’s safe.
• A robot arm welding parts of a car
together.
69. Implementation of Synchronous
Systems
The heart of a synchronous control
system is some kind of timer. This
timer can be mechanical or
electronic. The timer also needs :
1. A sequencing element that sets the
times at which outputs are switched
on and off. Remember that there are
no external inputs into a synchronous
timer.
2. An output stage that provides the
start and stop signals.
70. The timer may be :
1.Mechanical timer.
2.Electronic timer.
3.Microcontroller.
71. Mechanical Timer
All mechanical timers are
different kinds of cam timer, in
which a motor turning at a
constant speed is used to turn
lots of cams, as the cams turn
they push on switches to turn
them on or off.
73. Electronic Timer
• A dedicated circuit uses an oscillator
to give electronic clock pulses. Its
circuitry often involving the use of
logic gates which is then used to
control a sequence of switching.
• Programmable Logic Controllers
(PLCs) are commonly used in industry,
where a PLC contains the same kind
of microprocessor as a computer
75. Microcontroller
• It is a computer on a chip with an integrated
circuit that has all of the main bits of a computer
system in it.
• The timing sequence is usually programmed from
a computer before the microcontroller is placed in
the device to be controlled.
• Microcontrollers are used in mass production
because they are very cheap, also, the modern
washing machines and central heating systems
often use microcontrollers.
77. Sequential Function Charts
(SFCs)
• Many systems have sequential operation
requirements and Sequential Function
Charts (SFC’s) have become a popular
method of accurately specifying sequential
control requirements.
• It has long been established as a means of
designing and implementing sequential
control systems utilizing PLCs.
78. Many manufacturers offer program-ming
environments that allow engineers to
program controllers using graphical
methods.
SFC’s have many advantages for software
development both in the design stage as
well as the implementation, testing,
maintaining and fault finding stages.
79. In design stage :
• Detailed clear graphical specification.
• Non software people can specify or
verify programs.
In implementation and testing :
• Straight forward conversion from
specification to code .
• Structured testing or debugging.
80. In maintenance of software :
•Readily understood by engineer
modifying software.
In machine maintenance :
•Allows quick accurate fault
diagnosis.
81. Sequential function charts break a
sequential task down into steps
called transitions and actions.
These are drawn graphically to
describe a sequence of interactions.
Convention states that flow through
an SFC is from top to bottom unless
indicated by an arrow.
82.
83. The sequence is broken down into
steps (or states) where actions are
carried out.
The transition conditions define
logical conditions that cause the
process to move from the existing
step to the next step. Actions
contain three fields
84. An action consists of a qualifier
which defines what type of action,
for example S for set, R for reset and
N for continuous while in step.
As the design progresses more detail
can be added such as address
information as follows :
• Memory (%M)
• Input (%I)
• Output (%Q)
85.
86. Example
To illustrate the use of SFCs and how
they may be implemented, consider
the following simple example where
two pistons have to be controlled
using a PLC.
The operation requirements are as
follows :
87. 1. When a normally open switch (%I0.7) is
closed momentarily and both pistons are
home the following sequence should occur :
• Piston A has to be extended.
• When A is extended piston B is
extended.
• After B is extended for 3 seconds
piston B is retracted.
• When B is retracted piston A is
retracted.
88. 2.The sequence does not operate
until the switch is closed again i.e.,
it operates every time the switch is
closed and if piston A is in its
home position.
89.
90.
91. In some cases, the PLC has to start
and follow two branches separately
and simultaneously as follows :
93. Input / Output Devices
The input/output devices (I/O) used
with PLCs are different in type and
usage where it might be analog or
digital devices.
The I/O system provides the physical
connection between the equipment
and the PLC. Opening the doors on
an I/O card reveals a terminal strip
where the devices connect.
94.
95. There are many different kinds of I/O
cards which serve to condition the type
of input or output so the CPU can use it
for it’s logic. It's simply a matter of
determining what inputs and outputs
are needed, filling the rack with the
appropriate cards and then addressing
them correctly in the CPUs program.
96. Typical input devices used with PLCs
include :
1. Mechanical switches for position
detection.
2. Proximity switches.
3. Photoelectric switches.
4. Encoders.
5. Temperature & pressure switches.
97. 6. Potentiometers.
7. Linear variable differential Tr.
8. Strain gauges.
9. Thermistors.
10. Thermotransistors.
11. Thermocouples.
98. On the other hand, typical output
devices used with PLCs include :
1.Relays.
2.Contactors.
3.Solenoid valves.
4.Motors.
99. Input devices
• A digital input card handles
discrete devices which give a
signal that is either on or off such
as a pushbutton, limit switch,
sensors or selector switches.
• An analog input card converts a
voltage or current (e.g. a signal
that can be anywhere from 0 to
20mA) into a digitally equivalent
number that can be understood by
the CPU.
100. Digital or discrete sensors or on/off
sensors are considered input devices and
can easily be connected to the input
ports of the PLCs.
The input devices that give an analog
signal must be converted into digital
ones before inputting them to the PLC.
The following is a brief description for
each type of common input devices to be
used with PLCs.
101.
102. Mechanical switches
• A mechanical switch generates an
on/off signal due to some mechanical
input causing the switch to be opened
or closed, e.g, a cam or an arm.
• The presence of the mechanical input
leads to closing the switch or giving
level 1 to the PLC.
• On the other hand, the absence of it
leads to opening the switch or giving
level 0 to the PLC.
104. The mechanical switches may take one
of the following forms :
1.Normally opened contact NOC :
such switch has its contacts opened
at the absence of the mechanical
input, however that input is used to
close the switch contacts.
2. Normally closed contact NCC:
such switch has its contacts closed
at the absence of the mechanical
input, however that input is used to
open the switch contacts.
105. 3.Limit switches : these switches
are used to detect the presence
or passage of moving parts, e.g,
in case of lifts. It may be
actuated by a cam, roller or a
lever
Rotating cam
108. For example the limit switches are used to
detect the presence or passage of a movable
mechanical object such as :
• Rotary cam actuated type.
• Roller actuated type.
• Lever actuated type.
109. Proximity switches
The proximity switches are used to
detect the presence of an item without
making contact with it.
The forms of the proximity switches are :
1. Eddy current type.
2. Inductive type.
3. Reed type.
4. Capacitive type.
110. 1.Eddy current proximity switch : this
type has a coil supplied with constant
A.C and produces constant magnetic
field.
When a metallic object is close to that
coil, an eddy current will be induced in it.
Due to the eddy current a back e.m.f will
be induced in the original coil which will
affect the amplitude of its voltage.
The voltage amplitude can then be used
as a measure to indicate the distance
between the coil and the metallic object.
111. The voltage variation is used to activate
an electronic circuit comprising a
transistor, i.e, making that circuit on or off
according to the distance of the metallic
object. This conduction distance ranges
between 0.5 and 20 mm.
Metal object
Alternating magnetic field
Eddy current
Constant
alternating
current
112. 2. Inductive proximity switch : this type has
a coil wound on a ferrous core.
When one end of the core is being near a ferrous
object, there will be a change in the coil
inductance .
The inductance change can be monitored using a
resonant circuit, where the current in that circuit
may be used to activate an electronic switch
circuit to give an on/off device. The range of
detecting objects is from 2 to 15 mm.
113. 3.Reed proximity switch : this type is
consisting of two overlapping non-
touching strips of springy ferromagnetic
material sealed in a glass or plastic
envelope
116. Features of Proximity Sensor
1. Stable operation, unsusceptible to water, oil,
dust, light, etc.. :
Be able to use for machine tools splashed
with cutting oil or food processing machine
washed with water (magnetic type).
2. Resistant to vibration and shock :
Anti-vibration/shock since the whole circuit
can be coated with resin.
117. 3. Able to detect without any contact :
Detection distance is bout 0-30mm. No
damage on an object.
4. Higher speed/performance compared with
limit switch :
Long life and quick response.
5. Magnetic type is for metal detection,
capacitance is for everything except fluid :
Liquid in a paper cup can be also detectable.
118. 6. Susceptible to magnet effect :
High possibility of malfunction in an area
where large amount of electric current flows
such as
welding or electro magnetism.
143. Output devices
• Output devices can also consist
of digital or analog types.
• A digital output card either
turns a device on or off such as
lights, LEDs, small motors, and
relays.
144. • An analog output card will
convert a digital number sent by
the CPU to it’s real world
voltage or current.
• Typical outputs signals can
range from 0 - 10 V D.C or 4 - 20
m.A and are used to drive mass
flow controllers, pressure
regulators and position controls.
145. Types of Output Devices
1. Contactors .
2. Control Valves .
a. Types of valves .
b. Actuation of valves .
c. Cylinders : single and double acting .
3. Motors .
a. D.C motors .
b. Induction motors .
c. Stepper motors .
147. Two position valve
The 4/2 valve
2/2 Valve : flow from P to A
switched to no flow
A
P
A
P T
3/2 Valve : flow from P to A and
from A to T switched to T being
closed and flow from P to A
Control
Valves
148. Directional control valves
A – Piston with no current
A current through the
solenoid pulls to the right,
with no current the spring
pulls back to the left
173. Why communication networks
• Less Expensive
• Less Physical Space Required
• Simple Installation
• More Information Available at Lower Cost
• More Adaptable to Changes
• Future Expansion
• Easier Troubleshooting
• Easier PLC Programming
187. 3. Allen Bradley :
I = input
O = output
Rack
number
Terminal
number
Module
number
x : xxx / xx
Examples : I : 03 4 / 12
O: 00 2 / 05
188. 4. Siemens SISMATIC S5 :
I = input
Q = output
Byte
number
Bit number
X xx . x
Examples : I 1.4
Q2.1
189. PLC Hardwiring
There are three types of wiring associated with
a PLC namely :
The PLC wiring.
The device wiring.
The common (or return) wiring.
PLC Wiring :
The PLC has built-in input interfaces in both
the 16 and 32 I/O models. Since the input
interface is already wired to the PLC, input
wiring is easy and quick.
190. Device Wiring :
Input devices can be wired to a 120
VAC input interface in one of two
ways:
•They can be wired directly to the
interface.
•They can be wired to a terminal block
that is wired to the interface.
191. •If an input device is wired directly
to a PLC input interface, then one
side of the device should be wired
to the L1 hot line of the incoming
AC power source. The other side
should be wired to an input
terminal on the PLC.
192. An input device wired directly to
a PLC input interface.
120 V AC line
L1
193. If an input device is wired to a terminal
block instead of directly to the PLC
interface, then the line going out of the
input device should be wired to the
terminal block. The block, in turn, should
be wired to the PLC. In PLC applications,
the wiring of devices through a terminal
block is more common than wiring them
directly to the PLC.
194. 120 V AC line
L1
An input device wired to a PLC via a terminal
block.
195. Common Wiring :
Each input device connected to a PLC’s 120
VAC input interface must also be connected
to the AC return line, called the L2 common
line.
The device must have this common
connection for its electrical circuit to be
complete.
The input terminals on a 120 VAC interface
are arranged in two groups with each group
sharing a connection to the common line.
196. In a 10-input PLC, the first four input terminals
share one common connection, and the last six
share another.
197. In a 20-input model, the first four inputs
again share one common connection,
while the last sixteen share another
198.
199.
200. 24 V DC
Output Card
V+
00
01
02
03
04
05
06
07
24 V lamp
Relay
+24 V DC
Power
120 V AC
Power
Motor
Supply
Supply
Neut.
COM
202. 24-Volt DC input interfaces
Two types of DC input devices are used
with PLCs:
• Sourcing devices provide current
when they are ON.
• sinking devices receive current
when they are ON.
213. Signal Conditioning
• The potential divider can be used to reduce the
voltage from the sensor to the required level
such that :
in
21
2
V.
RR
R
outV
Vin
Vout
R1
R2
214. • Amplifiers can be used to increase the voltage
level using the Op Amps in one of three forms :
in
1
2
V.
R
R
outV
A : inverting
amplifier
221. Programming Rules
• Programs for microprocessor-based
controllers usually being loaded in
machine code as binary numbers and
representing the instructions.
• Assembly language can be used in
the form of mnemonics to indicate
the operations, e.g : LD , OUT , OR , …
… etc.
222. PLC Programming Methods
1. IL (Instruction List Programming) :
This is effectively mnemonic
programming.
2. ST (Structured Text) - A BASIC like
programming language.
3. LD (Ladder Diagram) - Relay logic
diagram based programming.
223. 4. FBD (Function Block Diagram) - A
graphical dataflow programming
method
5. SFC (Sequential Function Charts) -
A graphical method for structuring
programs
224. Relay Ladder Logics (RLL)
• Ladder logic is a drawing of
electrical logic schematics which
results from the usage of relays.
• It is now a graphical language very
popular for programming PLCs,
where sequential control of a
process or manufacturing operation
is simulated.
225. Motor stop – start circuit
L1 L2
1
2
M
Holding switch
226. • Its name is based on the observation that
programs are resembled by ladders, with
two vertical rails and a series of horizontal
rungs between them.
• Generally, manufacturers of programmable
logic controllers provide associated ladder
logic programming systems. However, the
ladder logic languages from two
manufacturers will not be completely
compatible.
227. • Even different models of programmable
controller within the same family may
have different ladder notation such that
programs cannot be interchanged
between models.
• Ladder logic can be thought of as a
rule-based language, rather than a
procedural language. A rung in the
ladder represents a rule.
228. • When implemented in a program-
mable logic controller, the rules are
typically executed sequentially by
software, in a continuous loop
(scan).
• However, proper use of programma-
ble controllers requires understand-
ing the limitations of the execution
order of rungs.
231. RELAY LADDER LOGIC
PROGRAMS & PROGRAMMING
The LD language itself can be considered
as a set of connections between logical
checkers (contacts) and actuators (coils)
such that :
If a path can be traced between the left
side of the rung and the output, through
asserted (true or closed) contacts, the
rung is true and the output coil storage
bit is asserted (1) or true.
232. If no path can be traced, then the
output is false (0) and the coil by
analogy to electromechanical relays is
considered de-energized
So, one can say that, ladder logic has
contacts that make or break circuits to
control coils. Each coil or contact
corresponds to the status of a single
bit in the programmable controller's
memory.
233. The contacts may refer to physical hard
inputs to the programmable controller
from physical devices such as
pushbuttons and limit switches via an
integrated or external input module, or
may represent the status of internal
storage bits which may be generated
elsewhere in the program.
234. The coil (output of a rung) may represent a
physical output which operates some device
connected to the programmable controller, or
may represent an internal storage bit for use
elsewhere in the program.
Each rung of ladder language typically has one
coil at the far right. Some manufacturers may
allow more than one output coil on a rung. On
the other hand, several contacts may be used
in different logic arrangements may be used at
the beginning of the rung to represent the
inputs.
235. 115 VAC
w a l l p l u g
r e l a y
i n p u t A
( n o r m a l l y c l o s e d )
i n p u t B
( n o r m a l l y o p e n
o u t p u t C
( n o r m a l l
l a d d e r l o
A B C
236. l a d d e r
p o w e r
s u p p l y
+ 2 4 V
c o m .
i n p u t s
o u t p u t s
p u s h b u t t o n s
l o g i c
P L C
A C p o w e r
115 Vac
n e u t .
A B C
l i g h t
237. Each program is a set of rungs that
reveals the sequence of the
operations in the controlled process.
H O T N E U T R
I N P U T S O U T P U T S
A B X
C D
E F
G
H
Y
N o t e : P o w e r n e e d s t o f l o
( A , B , C , D , E , F, G , H ) t o t u r n o n o u t
238. LD contacts & their types
As mentioned before, the contacts may
refer to physical hard inputs to the
programmable controller from physical
devices such as pushbutton switches,
selector switches and limit switches via an
integrated or external input module, or may
represent the status of internal storage
bits which may be generated elsewhere in
the program
239. disconnect circuit interrupter
breaker (3 phase AC)
normally open
limit switch
normally closed
limit switch
normally open
push-button
normally closed
push-button double pole
push-button
mushroom head
push-button
(3 phase AC) (3 phase AC)
240. Normally Open Contact (NOC)
This can be used to represent any input to
the control logic such as : a switch or
sensor, a contact from an output, or an
internal output. When solved, the
referenced input is examined for an ON
(logical 1) condition :
241. • If it is ON, the contact will close
and allow power (logic) to flow
from left to right.
• If the status is OFF (logical 0), the
contact is Open, power (logic)
will NOT flow from left to right.
242. Normally Closed Contact (NCC)
When solved, the referenced input is
examined for an OFF condition :
• If the status is OFF (logical 0) power
(logic) will flow from left to right.
• If the status is ON, power will not
flow.
243. LD coils & their types
Also, the coils (output of a rung) may
represent a physical output which
operates some device connected to the
programmable controller such as solenoid
valves, lights, motor starters and servo
motors, or may represent an internal
storage bit for use elsewhere in the
program.
244. Normally Open Coil
This can be used to represent any discrete
output from the control logic. When solved :
• If the logic to the left of the coil is
TRUE, the referenced output is ON
(logical 1).
• If the logic to the left of the coil is
FALSE, the referenced output is OFF
(logical 0).
245. Normally Closed Coil
This can be used to represent any discrete
output from the control logic. When solved :
• If the logic to the left of the coil is TRUE,
the referenced output is OFF (logical 0).
• If the logic to the left of the coil is FALSE,
the referenced output is ON (logical 1)
246. To identify an input or an output in a
program, a numbering system is used. This
numbering system has three purposes :
• To tell contacts apart in the program.
• Serves as an address for the location
of the input module in the real world.
• Serves as a memory address for the
contact in the processor memory.
247. Solving a Single Rung
Suppose a switch is wired to Input1, and a light
bulb is wired through Output1 in such a way that
the light is OFF when Output1 is OFF, and ON when
Output1 is ON.
• When Input1 is OFF (logical 0) the contact
remains open and power cannot flow from left to
right. Therefore, Output1 remains OFF (logical 0).
• When Input1 is ON (logical 1) then the contact
closes, power flows from left to right, and
Output1 becomes ON (the light turns ON).
255. The NAND rung
The NAND is a logic condition where an
AND gate is followed by a NOT gate or
putting a NOT gate on each input of an OR
gate as follows :
AND
A
B
NOT
NOT
NOT
OR
A
B
256. Inputs
Output
A B
0 0 1
0 1 1
1 0 1
1 1 0
Address Instruction Data
0 LOAD IN1
1 AND IN2
2 NOT
3 OUT OUT1
4 END
x400
x401
Y430
Mitsubishi PLC
x000
x001
Y000
Toshiba PLC
I0.1
I0.2
Q2.0
Siemens PLC
257. The NOR rung
The NOR is a logic condition where an OR
gate is followed by a NOT gate or putting a
NOT gate on each input of an AND gate as
follows :
OR
A
B
NOT
NOT
NOT
AND
A
B
258. Inputs
Output
A B
0 0 1
0 1 0
1 0 0
1 1 0
x400 x401
Y430
Mitsubishi PLC
x000 x001
Y000
Toshiba PLC notation
I0.1 I0.2
Q2.0
Siemens PLC
Address Instruction Data
0 LOAD IN1
1 OR IN2
2 NOT
3 OUT OUT1
4 END
259. The XOR rung
The XOR is a logic condition where an
output exists when either of the two inputs
is on but not when both are on follows :
OR
AND
NOT
NOTA
B
AND
260. Inputs
Output
A B
0 0 0
0 1 1
1 0 1
1 1 0
Address Instruction Data
0 LOAD IN1
1 AND NOT IN2
2 LOAD NOT IN1
3 AND IN2
4 OR
5 OUT OUT1
x400 x401
Y430
Mitsubishi PLCx400 x401
x000 x001
Y000
Toshiba PLCx000 x001
I0.1 I0.2
Q2.0
Siemens PLCI0.1 I0.2
261. Latching
• Sometimes it is necessary to hold an
output energizes even when the input
is ended.
• An example is a motor starting and
stopping using push button, where
the latch circuit is used to keep the
motor running after the contacts of
the starting switch being opened.
264. Ladder Programming Symbols
Several symbols are used to enter a ladder
program either using a the keypad of a
programming device with symbols or using a PC
software. The following are samples of such
symbols :
input output Start of a
junction
End of a
junction
Horizontal circuit link
265. Instruction Lists
• The instruction list programming for a
PLC differs according to the type of
the used PLC.
• The following table shows the
different types of PLCs and the
corresponding instructions to be used
with them.
266. Command
PLCs Types
IEC11
31-3
Mitsub
ishi
Omro
n
Sieme
ns
Telemec
anique
Sphere+
Schuh
Start a rung with
a NOC
LD LD LD A L STR
Start a rung with
a NCC
LDN LDI
LD
NOT
AN LN
STR
NOT
Series element
with a NOC
AND AND AND A A AND
Series element
with a NCC
ANDN ANI
AND
NOT
AN AN
AND
NOT
Parallel element
with a NOC
O OR OR O O OR
Parallel element
with a NCC
ORN ORI
OR
NOT
ON ON OR NOT
An Output ST OUT OUT = = OUT
267. twoANDblocks
Step Instruction
0 LD X400
1 OR X402
2 LD X401
3 OR X403
4 ANB
5 OUT Y430
Step Instruction
0 A(
1 A I0.0
2 O I0.1
3 )
4 A(
5 A I0.2
6 O I0.3
7 )
8 = Q2.0
Mitsubishi PLC
Siemens PLC
x400 x401
Y430
x402 x403
I0.0 I0.1
Q2.0
I0.2 I0.3
269. Boolean Algebra
• The instruction lists and ladder
diagrams can also been used to
represent mathematical operations
as follows :
• A . B = Q represents an AND circuit.
• A + B = Q represents an OR circuit.
• A = Q represents a NOT operation.
270. Example
Consider the following expression :
A + B . C = Q
this tells that there is the term A or the
term B and C will give the output Q, the
corresponding ladder diagram is :
A
Q
Siemens PLC
B C
271. XOR Example
Considering the XOR gate below :
• the input to the upper AND is : A and B
and its output is : A . B
OR
AND
NOT
NOTA
B
AND
Q
272. • the input to the lower AND is : A and B
and its output is : A . B
• Finally, the boolean expression for the
OR gate will be : Q = A . B + A . B
• The corresponding ladder diagram is :
A B
A B
Q
273. More Example
Considering the logic circuit shown below :
• the boolean expression for the circuit is :
(A . B + C) . D . E . F = Q
AND
A
B
OR
NOT
QANDNOT
C
D
E
F
275. Programming Examples
1. A signal lamp is required to be on if :
A pump is running.
And
The pressure is satisfactory.
Or
The test lamp is closed.
Pump
X400
Presu.
X401
Lamp
Y430
Test
X402
Step Instruction
0 LD X400
1 AND X401
2 LD X402
3 ORB
4 OUT Y430
5 END
276. 2. A machine has 4 sensors to detect the
safety and is required to be off if :
Any of the sensors gives input.
when the machine is stop, an alarm is sound.
Step Instruction
0 LDI X400
1 ANI X401
2 ANI X402
3 ANI X403
4 OUT Y430
5 LD X400
6 OR X401
7 OR X402
8 OR X403
9 OUT Y431
10 END
X400
X401 Mamchine
Y430
X400
X402
X403
X401
X402
X403
Alarm
Y431
278. Definition
INTERNAL UTILITY RELAYS (contacts) : These do
not receive signals from the outside world nor do
they physically exist. They are simulated relays
and are what enables a PLC to eliminate external
relays. There are also some special relays that
are dedicated to performing only one task. Some
are always on while some are always off. Some
are on only once during power-on and are
typically used for initializing data that was stored.
They are built-in functions in the PLCs
280. A PLC might have hundreds of internal
relays where some of them are battery
backed to ensure safe operation in case of
power failure.
Internal relays some times take different
names such as : auxiliary relays, markers,
flags, coils and bit storage .
To distinguish internal relays outputs from
physical relays outputs, they are given
different addresses such as :
281. a.Markers : M100 , M101 , … etc for
Mitsubishi PLC.
b.Flags : F0.0 , F0.1 , … etc for Siemens
PLC.
c.Coils : C001 , C002 , … etc for
Sprecher+ PLC.
d.Bits : B0 , B1 , … etc for
Telemecanique PLC.
e.Internal relays : R000 , R001 , … etc
for Allen Bradley PLC.
282. In ladder programming, internal relays
take the same symbols as the physical
outputs but with different addresses.
The most commonly usage of internal
relays is for latching circuits or for
checking purposes when energizing an
output under some conditions.
283. Examples
1.Checking an output : Consider a system
whose output is activated when two
different sets of input conditions are
satisfied, the ladder describing such
case is : X400 X401 M100
X402
M100 X403 Y430
Step Instruction
0 LD X400
1 OR X402
2 AND X401
3 OUT M100
4 LD M100
5 AND X403
6 OUT Y430
7 END
284. Step Instruction
0 LD X400
1 OR X401
2 OUT M100
3 LD X402
4 AND X403
5 OUT M101
6 LD M100
7 OR M101
8 OUT Y430
9 END
X400 M100
X401
X402 X403 M101
M100
Y430
M101
285. 2.Latching Circuit : the second use of
internal relays is to reset a latch circuit
as shown in the next example :
X400 M100
Y430
X401
M100
Y430
I0.0 F0.0
Q2.0
I0.1
F0.0
Q2.0
286. 3.Starting Multiple Outputs : the third
use of internal relays is to start a
circuit with multiple outputs as follows :
X400 X401
M100
M100 Y430
M100
X402 Y431
X403 Y432
287. 4.Battery-backed relays : for the latch
circuits, the internal battery-backed
relays are used to maintain the
operation of the output even when the
power is cut off.
X400
M300
M300
Y430
M300
288. 5.Setting and resting relays : the
internal relays are used also to set and
reset the operation of the output cycle
as follows :
X400
X401
Y430S
Y430R
X400
X401
Y430
LD X400
S Y430
LD X401
R Y430
289. The set and reset circuit can be done in
several ways as follows :
I0.0
I0.1
S
Q2.0
R
X000
X001
S
Y020
R
Q
FF
R110
Siemens PLC Toshiba PLC
290. Master Control Relay
The master control relay is used in the
ladder programming when a large number
of outputs are used or when it is needed to
divide the whole program into sections
M100
X402
X400
X401
M100
Y430
Y431
M100MCR
Step Instruction
0 LD X400
1 OUT M100
2 MC M100
3 LD X401
4 OUT Y430
5 LD X402
6 OUT Y431
7 MC M100
8 END
291. More than one master control relay :
Step Instruction
0 LD X400
1 AND X401
2 OUT M100
3 LD X402
4 AND X403
5 OUT M101
6 MC M100
7 LD X404
8 OUT Y430
9 MC M101
10 LD X405
11 OUT Y431
12 MCR M100
13 MCR M101
14 ..
15 ..
16 END
M100
M100X400
X404 Y430
X405 Y431
M101MCR
M101X402
X401
X403
M101
292. Jump (program flow control )
The conditional jump instruction is used
to control the execution of the ladder
program such that :
1. When an input enables the jump, the
program will proceed starting from the
rung after the jump end and the rungs
that lie between the start of the jump and
its end will be ignored.
2. When there is no input to the jump, the
program will proceed in its original form
without ignoring any rungs.
293. Examples
1. The following ladder shows a conditional jump
for a process such that a fan operates when
temp exceeds a some level , however, no
action takes place if temp is blow that level.
CJP 700
X402
X400
X401 Y430
Y431
EJP 700
295. Example (Central Heating)
Consider a central heating system with the
following features :
The boiler is thermostatically controlled and
supplies the radiator system in addition to a hot
water tank.
Pumps are used to supply hot water to either or
both the radiator and the tank according to the
desired sensors.
The whole system is controlled by a clock to
operate a certain time a day.
297. The power circuit for the central heating
system is :
Stop
Run
Clock
Boiler sensor
Room sensor
Tank sensor
Power
Outputs
Boiler
M1
M2
Inputs
298. The ladder & IL program for the central heating
system using Mitsubishi PLC is :
Inputs :
X400 Clock
X401 Boiler sensor
X402 Room sensor
X403 Tank sensor
Outputs :
Y430 Boiler
Y431 Pump M1
Y432 Pump M2
300. The ladder & IL program for the central heating
system using Siemens PLC is :
Inputs :
I0.0 Clock
I0.1 Boiler sensor
I0.2 Room sensor
I0.3 Tank sensor
Outputs :
Q2.0 Boiler
Q2.1 Pump M1
Q2.2 Pump M2
303. Simple Timers
A timer is simply a control built-in block
that takes an input and changes an output
based on time.
Timers count fractions of seconds or
seconds using internal CPU clock.
Timers act like relays with coils which when
energized result in closing or opening
contacts after some specified time interval.
304. In PLC programming a timer is simply
being treated as an output for a rung
while its control is represented by
contacts in somewhere else.
There are three basic timer types :
i. On-Delay timer TON or T-O
ii. Off-Delay timer TOF or O-T
iii. Pulse timers TP
305. Timer Types
•On-Delay Timer : this timer takes an
input, waits a specific amount of time,
then turns ON an output (or allows logic
to flow after the delay).
time
Output
Off
On
time
Output
Off
On
TP with
+ve going
output
306. •Off-Delay Timer : this timer takes turns
ON an output (or allows logic to flow) and
keeps that output ON until the set
amount of time has passed, then turns it
OFF (hence off-delay)
time
Output
Off
On
time
Output
Off
On
TP with
-ve going
output
307. Timer Memory
• EN - timer enabled bit
• TT - timer timing bit
• DN - timer done bit
• FS - timer first scan
• LS - timer last scan
• OV - timer value overflowed
• ER - timer error
• PRE - preset word
• ACC - accumulated time word
308. Timer Format
• Timer : timer No. T1
• Time Base : 0.01 or 0.1 or 1.0 sec
• Preset : 100
• Accum. : 0
Txxx
Preset value
Time Base
xxx
Register where
Accumulative
value stored
Timer Function
Block
311. Timer Programming
The on delay timer is used to delay the
operation of the output for some time
interval as follows :
Input
Timer
Output
Timer
time
time
Input
Output
Time
delay
312. X400
T450 Y430
T450 K5
I0.0
KT5.2
Q2.0
T0
T 0
Step Instruction
0 A I0.0
1 LKT 5.2
2 SR T0
3 A T0
4 = Q2.0
5 END
Step Instruction
0 LD X400
1 OUT T450
2 K 5
3 LD T450
4 OUT Y430
5 END
313. Sequencing
The timers can be used to energize more
than one output sequentially with a
specified time delay .
Q2.0
KT5.2
Q2.1
T0
T 0
Y430 T450 K5
X400
T450 Y431
I0.0
Q2.0Y430
314. T1 Motor 2
IR 1
T2 Motor 3
IR 1
IR 1
start stop IR 1
Motor 1
T2
T1
END
T1 Motor 2
IR 1
T2 Motor 3
IR 1
IR 1
start stop IR 1
Motor 1
IR 3
IR 2
END
TON T1
TON T2
Motor
Sequence
315. Cascaded Timers
Timers can be linked together to give longer
time delay than that for a single timer.
I0.2
Q0.3
10
T1.0
4001
10
T2.0
4002
Cascaded Timers
I0.1
Q0.1
Q0.1
316. T450 T451 K100
X400
T451 Y430
T450 K999
Step Instruction
0 LD X400
1 OUT T450
2 K 999
3 LD T450
4 OUT T451
5 K 100
6 LD T451
7 OUT Y430
8 END
Cascaded timers
317. Example (Timer Application)
Automatic mixing processes of liquids and other
compounds in the chemical and food industries are very
common.
The mixing station goal is to mix two liquids for a
specified time and then output the final product to a
storage tank.
The system consists of :
1. Two level sensors to monitor the flowing of the
liquids into the tank.
2. Three solenoid valves to control the flow of liquids.
3. A motor connected to an agitator to mix the liquids
into the tank.
319. The sequence of events for this automatic mixing process will
be as follows :
1. Open valve 1 until level 1 is reached for the first liquid .
2. Then close valve 1 .
3. Open valve 2 until level 2 is reached for the second
liquid .
4. Then close valve 2 .
5. Start the motor and agitate to mix the liquids into the
tank for a specified time .
6. Then stop the motor .
7. Open valve 3 up to a specified time to empty the mixed
product to a storage tank .
8. Then close valve 3 .
9. Repeat or end the mixing process as required .
320. The automatic mixing station will require the following
components using Mitsubishi PLC :
1. Inputs to the PLC :
Start push button X400
Stop push button X401
Level sensor LS1 X402
Level sensor LS2 X403
1. Outputs from the PLC :
Valve # 1 (VA1) Y430
Valve # 2 (VA2) Y431
Motor starter (MS1) Y432
Valve # 3 (VA3) Y433
321. Y432
X403
T450 K1200
M 100
Y430
M 100
M100
M100
M100
M 100
X400
X401
M 100
END
X402 X403 Y432 Y433
X402 X403 Y432 Y433
Y431
T450X403
Y433
T451 K180
M100 T450
M100 T451 T450
Y433
322. Step Instruction
12 ANI X403
13 ANI Y432
14 ANI Y433
15 OUT Y431
16 LD M100
17 AND X403
18 OUT T450
19 K 1200
20 LD M100
21 AND X403
22 LD M100
23 ANI Y433
Step Instruction
0 LD X400
1 OR M100
2 ANI X401
3 OUT M100
4 LD M100
5 ANI X402
6 ANI X403
7 ANI Y432
8 ANI Y433
9 OUT Y430
10 LD M100
11 AND X402
Step Instruction
24 ORB
25 ANI T450
26 OUT Y432
27 LD M100
28 ANI T450
29 OUT T451
30 K 180
31 LD M100
32 ANI T451
33 AND T450
34 OUT Y433
35 END
324. Step Instruction
12 AN I0.3
13 AN Q2.2
14 AN Q2.3
15 = Q2.1
16 A F0.1
17 A I0.3
18 LKT 1200
19 SR T0
20 A T0
21 = F0.2
22 A(
23 A F0.1
Step Instruction
0 A I0.0
1 O F0.1
2 AN I0.1
3 = F0.1
4 A F0.1
5 AN I0.2
6 AN I0.3
7 AN Q2.2
8 AN Q2.3
9 = Q2.0
10 A F0.1
11 A I0.2
Step Instruction
36 A T1
37 = F0.3
38 A F0.1
39 AN F0.3
40 A F0.2
41 = Q2.3
46 END
Step Instruction
24 A I0.3
25 )
26 O(
27 A F0.1
28 AN Q2.3
29 )
30 AN F0.2
31 = Q2.2
32 A F0.1
33 AN F0.2
34 LKT 180
35 SR T1
326. Simple Counter
A counter is simply a control built-in block that
takes counts the occurrence of an input signal.
This might happen in a conveyor system, when
counting persons passing through a door,
counting cars in a parking lot or counting the
revolutions of a shaft.
There are two basic types of counters - Up
counter and a Down counter :
•Up Counter : as its name implies, whenever a
triggering event occurs, an up counter increments
the counter.
•Down Counter : whenever a triggering event
occurs, a down counter decrements the
counter.
327. Counter Memory
• CU - count up bit
• CD - count down bit
• DN - counter done bit
• OV - overflow bit
• UN - underflow bit
• PRE - preset word
• ACC - accumulated count word
328. Counter Format
•Counter : counter No. CTR1
•Preset value : 5
•Accum. : 0
Preset
value
CTR
Storage
Register
Counter Function
Block
331. Counter Programming
The counter is used to count the events of
occurrence of an input signal and then
operates its contacts as follows :
Input
Counter
Output
Counter
CTD
counter
CV
RST
333. Step Instruction
0 LD X400
1 RST C460
2 LD X401
3 OUT C460
4 K 10
5 LD C460
6 OUT Y430
7 END
X400
X401
Y430
RESET
C460
K 10
Out
C460
Mitsubishi PLC counter programming
334. Step Instruction
0 A I0.0
1 CU C0
2 A I0.1
3 R C0
4 = Q2.0
5 END
I0.0
I0.1
Q2.0
CU
CV
R
C0
Siemens PLC counter programming
335. Counter Application
Consider the following packing machine,
where it is required to pack 6 objects in a
box and then pack 12 objects in another
box in another path as shown :
6 in box
12 in box
336. Step Instruction
0 LD X400
1 OR C461
2 RST C460
3 K 6
4 LD X401
5 OUT C460
6 LD C460
7 OUT Y430
8 LD X400
9 OR C461
10 RST C461
11 K 12
12 LD X401
13 AND C460
14 OUT C461
15 LD C461
16 OUT Y431
17 END
Mitsubishi PLC program
C460
C461
X400
X401
Y430
RESET
C460
K 6
Out
C460
X400
X401
Y431
RESET
C461
K 12
Out
C461
C461
337. Step Instruction
0 A I0.0
1 O C1
2 CU C0
3 LCK 6
4 A I0.1
5 R C0
6 = Q2.0
7 A I0.0
8 O C1
9 CU C1
10 LCK 12
11 A I0.1
12 R C1
13 A C0
14 = Q2.1
15 END
Siemens PLC program
I0.0
I0.1 Q2.0
I0.0
I0.1 Q2.1C0
CU
CV
R
CU
CV
R
C1
6
12
C1
C1
C0
338. In 3 Reset
In 1
In 2 Down-Counter
Up-Counter
Counter Output
Using up
and down
counters
339. Step Instruction
0 A I0.0
1 CU C0
2 A I0.1
3 CD C0
4 AN F0.0
5 LKC 50
6 S C0
7 A I0.2
8 R C0
9 A C0
10 = Q2.0
I0.0
I0.1
Q2.0
CU
CD
S
KCV50
Up and down counters
with a Siemens PLC
F0.0
I0.2
CV
R
C0
341. Definition
• The shift registers are electronic internal
devices used for storing data.
• They represent a number of internal relays
grouped together and allowing stored bits
to be shifted from one relay to another.
• Their main usage is to keep tracking of
particular items or where a sequence of
operations is required.
342. Shift Registers Operation
Suppose that we have 8 internal relays
grouped together :
And each relay may store an on or off
state as follows :
1 2 3 4 5 6 7 8
1 0 1 1 0 0 1 0
343. If a signal is received from an input
devices sets the 1st internal relay to the
state 0, by then the grouped set of relays
in the register will be shifted as follows :
before the update
after the update
0 1 0 1 1 0 0 1
1 0 1 1 0 0 1 0
344. Shift Registers Programming
Consider a 4-bit shift register, it can be
represented in ladder diagram by three inputs
such that :
• The 1st input is used to reset the register
(RST).
• The 2nd input is used to energize the first
internal relay of the register (OUT).
• The 3rd input is used to shift the states of the
internal relays of the register along by one
(SFT).
345. In 3
RST
IR 1 Out 1
In 2
SFT
In 1
OUT
IR 2 Out 2
IR 3 Out 3
IR 4 Out 4
Shift register internal relays
IR 1 , IR 2 , IR 3 , IR 4
Output controlled by 1st relay
in the register
Output controlled by 2nd relay
in the register
Output controlled by 3rd relay
in the register
Output controlled by 4th relay
in the register
346. X402
RST
M140 Y430
X401
SFT
X400
OUT
M141 Y431
M142 Y432
M143 Y433
M140
Step Instruction
0 LD X400
1 OUT M140
2 LD X401
3 SFT M140
4 LD X402
5 RST M140
6 LD M140
7 OUT Y430
8 LD M141
9 OUT Y431
10 LD M142
11 OUT Y432
12 LD M143
13 OUT Y433
14 END
Mitsubishi PLC