PLC 5
PLC 5
Logic Controllers
Third Edition
Frank D. Petruzella
McGraw-Hill
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
01
Status 01
ControlLogix Processor
ControlLogix processors provide more flexible
memory structure.
With other controllers you develop your
application in such a way as to fit within the
confines of the controller's data table.
Task 1
Program 32
Program 1
Main Program
Routine (Local Tags)
Fault
Routine Other
Routines
Routines contain the logic of the executable code.
A routine is similar to a program file found in the
PLC-5 or SLC processor and is basically a set of
logic instructions in a single programming logic,
such as ladder logic.
ControlLogix Tags
The ControlLogix controller uses tags instead of
addresses to access data. The following types of tags are
used to identify memory locations:
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
O:4/7 light output O:4/7
module senses a I:3/6
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
Vertical Scanning
Order
One Continuous
cycle
Check mode
International Standard for Programmable
Controllers (IEC 61131-3) Defined Standard
Programming Languages
Ladder Diagram (LD) – graphically depicts a process
with rungs of logic, similar to the relay ladder logic
schemes that were replaced by PLCs.
Sequential Function Charts (SFC) – flowchart of steps (one or more
actions) and transitions (defined conditions) before passing to the next step.
Instruction List (IL) – assembler-type, text-based language for building
small applications or optimizing complex systems.
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
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 O:4/6
File Type : Slot Nu. / Bit Nu. file 0
I:3/12
O:0:4/6
Address Bit address
input
terminal Input image table
I:3/12 Energized
file 1
output
I:3/12
Bit address
Closed input
I1:3 O:0:4
User-programmed rung
12 6
Parallel Input Branch Instructions
A C Branch instructions are used
to create parallel paths of
input condition instructions.
If at least one of these parallel
B branches forms a true logic
path, the logic is enabled.
Parallel Output Branching
A C
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