ميحرلا نمحرلا هللا بسم
PLC Course
مقرر الحاكمات المنطقية المبرمجة
Lec 2
PLC Operation
During the PLC operation, the CPU completes three sequential
processes: Read (Input Scan), Execute (Program Scan), and Write
(Output Scan)
(2) Execute
(1)Read (3)Write
PLC Operation
(1) Read (Input Scan):
Detects the state of all input devices that are connected to the PLC
(2) Execute (Program Scan):
Executes the user control program that stored in its memory
(3) Write (Output Scan):
Updates (energizes or de-energize) the state of all output devices that
are connected to the PLC.
This process of sequentially reading the inputs, executing the program
in the PLC memory, and updating the outputs is known as scanning
Process.
PLC Programming Languages
PLC Programming Languages
There are four programming languages that are used to program a
PLC:
1. Ladder Diagram (LD)
2. Function Block Diagram (FBD)
3. Structured Text (ST)
4. Instruction List (IL)
The commonly used programming language is Ladder Diagram.
PLC Programming Languages
1. Ladder Diagram (LD)
A graphical programming language. Initially programmed with
simple contacts that simulated the opening and closing of
switches and relays, Ladder Logic programming has been
expanded to include such functions as counters, timers, shift
registers, and math operations.
PLC Programming Languages
2. Function Block Diagram (FBD)
A graphical programming language for describing signal and
data flows through re-usable function blocks. FBD is very useful
for expressing the interconnection of control system algorithms
and logic.
PLC Programming Languages
3. Structured Text (ST)
A high level text language that supports structured programming.
It has a language structure (syntax) and supports a wide range of
standard functions and operators.
PLC Programming Languages
4. Instruction List (IL)
A low level language “like assembly language” that is based on
similar instructions list languages found in a wide range of
today’s PLCs.
Instruction Description
LD : load input
LDI : load inverse input
OR : or with = branching = parallel
ORI : or inverse with
AND : and with = series
ANI : and inverse with
OUT : out to
PLC Programming Languages
4. Instruction List (IL)
LD X1
OR X2
ANI X3
OUT Y
Ladder diagram
Instruction List
Example: A PLC program using different
Programming Languages
PLC Configuration
What devices does a PLC interact with?
• INPUT RELAYS-(contacts)These are connected to the
outside world. They physically exist and receive signals
from switches, sensors, etc.
• 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.
What devices does a PLC interact with?
• COUNTERS-These again do not physically exist. They
are simulated counters and they can be programmed to
count pulses. Typically these counters can count up, down
or both up and down.
• TIMERS-These also do not physically exist. The most
common type is an on-delay type. Others include off-
delay.
What devices does a PLC interact with?
• OUTPUT RELAYS-(coils)These are connected to the
outside world. They physically exist and send on/off
signals to solenoids, lights, etc. They can be transistors, or
relays depending upon the model chosen.
• DATA STORAGE-Typically there are registers assigned
to simply store data. They are usually used as temporary
storage for math or data manipulation. They can also
typically be used to store data when power is removed
from the PLC.
Main Components of PLCs
Main Components of PLCs
There are a wide range of PLCs with different sizes, but all contain six basic
components:
1) Input Module (receive signals from input devices = sensors of the PLC)
2) Output Module (send the control action to output devices = actuator of the
PLC)
3) CPU (Central Processing Unit)
4) Memory
5) Power Supply
6) programming unit, device, panel or PC/software
Memory
The most important characteristic of a PLC is the user’s ability to change
the control program quickly and easily.
The memory is the area of the PLC where all the sequences of instructions,
or programs, are stored and executed by the processor to provide the desired
control of field devices.
The memory sections that contain the control programs can be changed, or
reprogrammed, to suite the manufacturing line procedure changes or new
system start-up requirements.
Memory
The total memory in a PLC is actually composed of two different
memories:
1) Executive Memory (System Memory)
2) Application Memory (User Memory)
Data Table Area
User Program Area
(1) Executive Memory (System Memory)
The executive memory is a collection of permanently stored programs
that are considered part of the PLC itself. These supervisory programs
direct all system activities, such as execution of the control program and
communication with peripheral devices.
The executive section is the part of the PLC’s memory where the system’s
available instruction software is stored (i.e., relay instructions, block
transfer functions, math instructions, etc.).
This area of memory is not accessible to the user (ROM Memory).
The executive memory is called the system memory
(2) Application Memory (User Memory)
The application memory is also called user memory.
According to its function, the application memory is classified to two types:
(1) Data Table Area (2) User Program Area
The User Program Area provides a storage area for the user-programmed
instructions that form the application control program.
The Data Table Area is composed of several areas, each having a specific
function and usage as illustrated in the following figure.
The usage of Data Table Area
Stores the status of digital inputs connected to
1 the PLC’s input interface.
1
2 Stores the status of the control actions of the
2 digital output devices that are connected to
3
the PLC’s output interface.
Contains storage bits that are referred to as
either internal outputs (or inputs), internal
coils (control relays), or internals.
These internals provide an output, for
interlocking purposes, of ladder sequences in
3
the control program.
Internal outputs do not directly control
output devices because they are stored in
(2) Application Memory addresses that do not map the output (or
input) table and, therefore, any output
devices.
Power Supply
Its responsibility is not only to provide internal DC voltages to the system
components (i.e., processor, memory, and input/output interfaces), but also
to monitor and regulate the supplied voltages and warn the CPU if
something is wrong.
The power supply, then, has the function of supplying well-regulated power
and protection for other PLC system components as it contains (low
voltage transformer - bridge rectifier circuit – filter – voltage regulator).
A bridge rectifier circuit is used to convert an AC power to a DC power.
The output of the rectifier circuit is not pure DC as some of AC pulses ,
known as ripples, remain and must be removed by a filter.
Power Supply
The filter in the power supply circuit is used to remove the remaining AC
pulses or ripples.
A voltage regulator is a circuit that creates and maintains a fixed output
voltage, irrespective of changes to the input voltage or load conditions.
Most PLCs, however, require a 120 VAC or 220 VAC power source, while
a few controllers will accept 24 VDC.
Input Devices
Toggle Switch
Push button Switch
Selector Switch
Temperature Switch
Limit Switch
Liquid Level Switch
Relay Contacts
Photoelectric Sensors (Photo Sensors )
Pressure Switch
Toggle Switch Push Button Switch Selector Switch
Temperature Switch Limit Switch Liquid Level Switch
Photo Sensor
Pressure Switch
Input Devices
Temperature Switch:
• An inexpensive temperature-sensing mechanism is the bimetallic strip.
• bimetallic strip is a thin strip consisting of two different metals, joined
face to face, each metal having a different rate of thermal expansion.
• When the strip heats or cools, different rates of thermal expansion
between the two metals causes it to bend.
• The bending of the strip can then be used to actuate a switch contact
mechanism.
Input Devices
Limit Switches:
• These limit switches closely like toggle or selector hand switches fitted
with a lever pushed by the machine part.
• Often, the levers are tipped with a small roller bearing, preventing the
lever from being worn off by repeated contact with the machine part.
• Most applications use the limit switch to detect the position.
Input Devices
Liquid Level Switch:
• A floating object can be used to actuate a switch mechanism when the
liquid level in a tank rises past a certain point.
• Level switches can also be designed to detect the level of solid materials
such as wood chips, grain, coal, or animal feed in a storage silo, bin, or
hopper.
Input Devices
Pressure Switch:
• Gas or liquid pressure can be used to actuate a switch mechanism if that
pressure is applied to the switch , it converts pressure to mechanical force.
• The mechanical force can then be used to actuate a switch contact
mechanism.
Input Devices
Pressure Switch:
The components of a pressure
switch include:
micro-switch (A),
operating pin (B),
range spring (C),
operating piston (D),
insulated trip button (E),
switch case (F),
trip setting nut (G),
inlet pressure (H)
Output Devices
Control relays (CRs)
Motor
Solenoids
Valves
Alarms
Fans
Lights
Output Devices
Solenoids
• A solenoid is an electromechanical device which allows for an electrical
device to control the flow of a gas or liquid (valves).
• The electrical device causes a current to flow through a coil located on the
solenoid valve.
• This current flow in turn results in a magnetic field which causes the
displacement of a metal actuator.
• Electromagnetic solenoids are used in water-pressure valves.
Solenoid basic wired coil
Solenoid Valve
Output Devices
Control Relay (Electromagnetic Relay):
• An electromagnetic relay is a magnetic switch. It uses electromagnetism
to switch contacts.
• A relay will usually have only one coil but may have any number of
different contacts.
Electromagnetic Relay
N.C (Normally
Closed Contact)
N.O (Normally
(Common)
Opened Contact)
Electromagnetic Relay
Relay Operation
(1) With no current flow through
the coil (the coil is de-energized),
the armature is held away from the
core by spring tension.
(2) When the coil is energized, the
electromagnetic field moves the
armature towards the core causing the
contact points of the relay to open or
close.
Physical Relay with three different contacts
Relay coil power source
5v/6v/12v/24v/48v/100v
N.O
N.C
common
Relay Connection with A 220v Device/Load
Example1: writ the truth table for the following relay circuit
A B C ON
0 0
OFF
0 1
1 0
1 1
OFF
C
Solution:
ON
OFF
C = A/ B
OFF
C
Example2: writ the truth table for the following relay circuit
A B C ON
0 0
0 1 OFF
1 0
1 1
ON
C
Solution:
ON
OFF
C =(A . B) /
NAND gate ON
C
Example 3:
For the Relay in the following figure, explain the number of contacts, the type
and pins number for each contact. How many devices can be controlled using this
relay?
1 2 3 4 5 6
10
11
9 8 7
Solution
The number of contacts = 6
• 3 Normally Open (NO) contacts with the following pins numbers:
(1 , 9) & (3 , 8) & (5 , 7)
• 3 Normally Closed (NC) contacts with the following pins numbers:
(2 , 9) & (4 , 8) & (6 , 7)
The number of devices that can be controlled using this relay is 6
1 2 3 4 5 6
10
11
9 8 7
THE END