Basics of PLC Programming
Basics of PLC Programming
Logic Controllers
Chapter 5
Basics of PLC
Programming
Processor Memory Organization
The memory of a PLC is organized
by data types.
Input/output locations
Data table Internal relay and
timer/counter locations
Input module
Output module
Output
Processor continually OFF
activates or deactivates
output status according
to output image table
file status Output
ON
1
0
Status 1
0
Program Scan
During each operating cycle, the processor reads all
inputs, takes these values, and energizes or de-energizes
the outputs according to the user program. This
process is known as a scan.
I/O scan – records status data of input
devices. Energizes output devices that
have their associated status bits set to
ON (1)
Read inputs
The scan is a
a continuous
and sequential
process
Adjusts Run
outputs program
Data Flow Overview
Input Output
Input data Input Output data Output
image
modules table file image
modules
table file
Program
When the input is The processor turns
closed, the input light output O:4/7
module senses a I:3/6 O:4/7
ON during the next
voltage and an ON During the program I/O scan
condition (1) is scan the processor
entered into the sets instructions I:3/6
input table bit I:3/6 and O:4/7 to ON (1)
Scan Patterns
Horizontal Scanning
Order
Used by Allen Bradley
The processor examines
input and output
instructions from the
first command, top left
in the program,
horizontally, rung by
rung.
End of ladder
Vertical Scanning
Order
One Continuous
cycle
Check mode
International Standard for Programmable
Controllers (IEC 61131-3) Defined Standard
Programming Languages
Sequential
Ladder Diagram
Functional Function
Block(LD) Charts
– graphically
Diagram (SFC) – graphical
(FBD) flowchart
depicts a process
of
Structured List
Instruction Text(IL)
(ST)– –assembler-type,
a language developed for IEC
text-based
steps
with rungs
(one or
depiction ofofprocess
more
logic,actions)
similar and
to the
flow using transitions
relay and
simple ladder
(defined
logic
complex
to provide
language high-level
for building syntax
small using "If" and
applications or "Then"
conditions)
schemes
buildingthatbefore
were
blocks, passing
replaced
ranging toby
from the
PLCs.
next step.
analog I/O to closed
statements.complex systems.
optimizing
loop control, algorithms, and diagnostics.
Relay-Type Instructions
The ladder diagram language is basically a symbolic
set of instructions used to create the controller
program.
I:012
I:012
04
IfIfthe
thestatus
statusbit
bitisis0 1(OFF),
(ON), then the instruction
is TRUE.
is FALSE.
Examine If Open (XIO) Instruction
I:012
I:012
04
IfIfthe
thestatus
statusbit
bitisis1 0(ON), then
(OFF), thethe
then instruction
instruction
isisFALSE.
TRUE.
Output Energize (OTE) Instruction
Analogous to the relay coil. The
Symbol processor makes this instruction
true (analogous to energizing a coil)
when there is path of true XIC and
XIO instructions in the rung.
O:013
I:012
11 15 01
Button
Buttonnot actuated
actuated
A Output
ON
OFF
False
True
A Output
ON
OFF
True
False
Ladder Rung
Output
A B C instruction
Input conditions
D
Each
AFor contact
ladder or coil
an output
rung symbol
consists
to be of aisset
activated referenced
or
of input with at
energized, anleast
conditions,
address number
represented bythat
one left-to-right identifies
contact
path whatmost
ofinstructions,
contacts is and
being
beanclosed.
output
evaluated andatwhat
instruction
A complete is referred
the end
path is being
of thecontrolled.
rung, Thelogic
sameby the
represented
to as having
contact
coil instruction
symbol.
continuity. Whencan logicbeexists
used throughout the program
the rung condition is
whenever that
said to be condition needs to be evaluated.
TRUE.
Rung Continuity
LS_1 SOL_5
The
The Examine
Examine IfIf Closed
Closed instruction
instruction isis TRUE
FALSE
making
making the
the rung
rung TRUE
False
Allen-Bradley SLC-500 Controller Addressing
Address
output
terminal
Output image table O0:4/6
file 0
O:0:4/6
Address Bit address
input
terminal Input image table
I1:3/12 Energized
file 1
output
I:3/12
Bit address
Closed input
I1:3 O:0:4
User-programmed rung
12 6
Structure of A 16-Bit Word
Bit OFF ON
Word 0
(16 bits)
1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D
B
E
A B C Y
Reprogrammed to
obtain the required
Contact logic.
D C instruction
C repeated
E
PLC Matrix Limitation Diagram
Max series
contacts
A D Y
B C D
Reprogrammed to obtain the
B E required logic
A C E
Programming for Different Scan Patterns
A B C Y
Original program
D E
F
Y = (ABC) + (ADE) + (FE) + (FDBC)
A B C Y
A D E
Reprogrammed to obtain the
F E required logic
F D B C
Internal Control Relay
The internal output operates just as any other output
that is controlled by programmed logic; however, the
output is used strictly for internal purposes.
Internal
relay coil
Rung 1
Rung 2
1747-L40E
You simply
scroll down
the list until
you find the
processor you
are using and
select it.
I/O Configuration Screen