Basics of PLC
Basics of PLC
1 of 62
PLC Architecture
2 of 62
PLC System
3 of 62
Processor Memory Organization
The memory of a PLC is organized by types.
4 of 62
Memory Map
A memory map can be used to show how memory is
organized in a PLC.
▪ Input/output locations
▪ Internal relay and
Data table timer/counter locations
5 of 62
Program Files
7 of 62
Data Files
Data files are organized by the type of data they contain
8 of 62
Input Table File Operation
Input module
Switch Open
Binary 0 stored
0
9 of 62
Input Table File Operation
Input module
Processor continually
Switch Closed reads current input
status and updates
input image table file
Binary 1 stored
1
10 of 62
Output Table File Operation
Output module
Output
Processor continually OFF
activates or deactivates
output status according
to output image table
file status
Status 0
11 of 62
Output Table File Operation
Output module
Processor continually
activates or deactivates
output status according
to output image table
file status
Output
ON
1
Status 1
12 of 62
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)
Because the inputs can change at any time, the PLC must
carry on this process continuously.
13 of 62
Scan Process
The scan time indicates how fast the controller can react
to changes in inputs. Scan times vary with computer
model and program content, and length. If a controller
has to react to an input signal that changes states twice
during the scan time, it is is possible that the PLC will
never be able to detect this change.
14 of 62
Scan Process
Read inputs
The scan is a
a continuous
and sequential
process
Adjusts Run
outputs program
15 of 62
Data Flow Overview
Input Output
data Input data
Input image Output Output
modules table file image modules
table file
Program
I:3/6 O:4/7
I:3/6 O:4/7
Program
When the input is
The processor turns
closed, the input
light output O:4/7
module senses a O:4/7
voltage and an ON
I:3/6 ON during the next
I/O scan
condition (1) is During the program scan the
entered into the processor sets instructions
input table bit I:3/6 I:3/6 and O:4/7 to ON (1)
17 of 62
Scan Patterns
Horizontal Scanning
Order
The processor examines
input and output
instructions from the
first command, top left
in the program,
horizontally, rung by
rung.
End of ladder
In addition to the program itself, the scan time is also dependent on
the clock frequency of the processor!
18 of 62
Scan Patterns
Vertical Scanning
Order
The processor examines
input and output
instructions from the
first command, vertically,
column by column and
page by page. Pages are
executed in sequence.
End of ladder
Misunderstanding the way the PLC scans can cause programming
bugs!
19 of 62
PLC Programming Languages
The term PLC programming language refers to the method
by which the user communicates information to the PLC.
Functional
chart
Boolean language
20 of 62
Comparing Programming Language
PB1 CR1 CR2 SOL
Relay Schematic
LS1
21 of 62
Relay-Type Instructions
The ladder diagram language is basically a
symbolic set of instructions used to create the
controller program.
22 of 62
Examine If Closed (XIC) Instruction
I:012
I:012
04
24 of 62
Examine If Closed (XIC) Instruction
I:012
I:012
04
25 of 62
Examine If Closed (XIC) Instruction
I:012
I:012
04
26 of 62
Examine If Open (XIO) Instruction
I:012
I:012
04
28 of 62
Examine If Open (XIO) Instruction
I:012
I:012
04
29 of 62
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.
30 of 62
Output Energize (OTE) Instruction
O:013
I:012
11 15 01
31 of 62
Output Energize (OTE) Instruction
O:013
I:012
11 15 01
A Output
OFF
False
A Output
ON
True
33 of 62
Status Bit Examples
A Input module Bit status
Button actuated
A Output
ON
True
A Output
OFF
False
34 of 62
Ladder Rung
Output
instruction
A B C
Input conditions
D
Input conditions
D
36 of 62
Rung Continuity
LS_1 SOL_5
37 of 62
Rung Continuity
LS_1 SOL_5
38 of 62
Allen-Bradley SLC-500 Controller Addressing Address
output
terminal
Output image table O0:4/6
file 0
O:0:4/6
Bit address
Address
input
terminal Input image table Energized
I1:3/12 file 1 output
I:3/12
Bit address
Closed input
I1:3 O:0:4
User-programmed rung
12 6
39 of 62
Structure of A 16-Bit Word
Bit OFF ON
Word
(16 bits)
0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
I/O Connection Diagram
L1 L2 L1 L2
PB1 SOL 1
I:4/5 O:2/3
PL 1
LS1
I:4/6 O:3/6 R
40 of 62
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
branches forms a true logic
B path, the logic is enabled.
41 of 62
Parallel Output Branching
A C
D
B
E
44 of 62
PLC Matrix Limitation Diagram
Max series
contacts
B C D
Reprogrammed to obtain the
B E required logic
A C E
46 of 62
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
47 of 62
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.
48 of 62
Extending the Number of Series Contacts Using
an Internal Control Relay
Internal
relay coil
Rung 1
Rung 2
49 of 62
Programming The XIC Instruction
PB1 PB2
Hardwired Circuit
PL
Note that both pushbuttons are represented by the XIC symbol. This
is because the normal state of an input (NO or NC) does not matter!
What does matter is that if contacts need to close to energize the
output, then the XIC instruction is used. Since both PB1 and PB2
must close to energize the PL, the XIC instruction is used for both.
50 of 62
Programming The XIO Instruction
PB1
PB1
CR PL
CR1
PL
User program providing
the same results
Hardwired Circuit
When the pushbutton is open in the hardwired circuit, relay coil CR is de-
energized and contacts CR1 close to switch the PL on. When the
pushbutton is closed, relay coil CR is energized and contacts CR1 open
to switch the PL off. The pushbutton is represented in the user program
by an XIO instruction. This is because the rung must be true when the
external pushbutton is open, and false when the pushbutton is closed.
51 of 62
Operation of The XIC and XIO Instructions
52 of 62
Operation of The XIC and XIO Instructions
State of the output as determined by the changing
state of the inputs in the rung
Inputs Output Bit status
Time
XIC XIO OTE XIC XIO OTE
53 of 62
Entering the Ladder Diagram
A personal computer is most often used to enter the
ladder diagram.
54 of 62
RSLogix Main Screen
Different screens, toolbars and windows dialog boxes are
used to navigate through the Windows environment
55 of 62
Bit Instructions Tool Bar
56 of 62
Select Processor Type Screen
The programming software needs to know what
processor is being used in conjunction with the program.
1747-L40E
You simply
scroll down
the list until
you find the
processor you
are using and
select it.
57 of 62
I/O Configuration Screen
58 of 62
Data File Screen
Data file screens
contain data that
is used in
conjunction with
ladder program
instructions. These
include:
Input
Output
Timer
Counter
Integer
Bit
59 of 62
Monitoring a Ladder Logic Program
Operation of the logic is apparent from the highlighting
of rungs of the various instructions on screen, which
identifies the logic state in real time and has logic
continuity.
60 of 62
Modes of Operation
A processor has basically two modes of operation:
the program mode or some variation of the run mode.
Program Mode – may be used to
➢ enter a new program
➢ edit or update an existing program
➢ upload files
➢ download files
➢ document programs
➢ change software configurations
61 of 62
Variations of the Run Mode
Run Mode – is used to execute the
user program. Input devices are monitored
and output devices are energized
accordingly.
62 of 62