Professional Documents
Culture Documents
Chapter 4.1 Basics of PLC Programming - A - Siemens
Chapter 4.1 Basics of PLC Programming - A - Siemens
Chapter 4.1 Basics of PLC Programming - A - Siemens
Basics of PLC
Programming
Section 4.1
http://phenikaa-
uni.edu.vn
• Work memory: The
work memory is volatile
memory that contains
the code and data
blocks. The work
memory is integrated
into the CPU and cannot
be extended. Work
memory includes Code
work memory and Data
work memory.
http://phenikaa-
uni.edu.vn
• Retentive memory:
The retentive memory
is non-volatile
memory for saving a
limited amount of
data in the event of
power failure
http://phenikaa-
uni.edu.vn
• Additional memory areas include process images
and temporary local data.
http://phenikaa-
uni.edu.vn
How to access to
data memory?
http://phenikaa-
uni.edu.vn
How to access to
data memory?
http://phenikaa-
uni.edu.vn
An address is a label or number that
indicates where a certain piece of
information is located in memory.
Physic-based addressing
schemes are used with
Siemens SIMATIC S7.
Tag-based addressing is used with
SIMATIC S7 controllers.
SIMATIC S7 1500
addressing format.
SIMATIC S7 1500
addressing format.
IBa
Memory
Byte number
areas(I, Q, M…)
SIMATIC S7 1500
addressing format.
IWa
Memory
High byte number
areas(I, Q, M…)
SIMATIC S7 1500
addressing format.
ID a
IW a IW a+2
Memory
High byte number
areas(I, Q, M…)
SIMATIC controllers consist of operating
system and user program
Code Blocks
Organization blocks
(OBs) forms the
interface between the
operating system of
the CPU and the user
program. The
organization blocks
determine the order
in which the user
program is executed.
Code Blocks
Functions (FCs) are
blocks without cyclic
data storages.
Code Blocks
Function block (FB)
is a code block with
static data. An FB
allows you to pass
parameters in the
user program.
Code Blocks
Data blocks (DBs) are
data areas in the user
program that contain
user data.
Section 5.2
Program Scan
During each program scan cycle, the processor
reads all the inputs, takes these values, and
energizes or de-energizes the outputs according to
the user program.
The time it takes to complete a scan cycle is a
measure of how fast the controller can react to
changes in inputs.
I0.0 Q0.0
Scan process
applied to a
multiple rung
program.
Vertical versus horizontal scan patterns.
Section 4.3
Hardwired relay
control circuit
Equivalent ladder
diagram program
Instruction list programming language consists
of a series of instructions that refer to the basic
AND, OR, and NOT logic gate functions.
Hardwired relay
control circuit
Equivalent instruction
list program
Functional block diagram programming uses
instructions that are programmed as blocks wired
together to accomplish certain functions.
Ladder diagram and functional block diagram
programming used to produce the same logical
output.
Ladder diagram
Equivalent
function block
diagram.
Sequential
function chart
programming
language is
similar to a
flowchart of
your process.
Ladder diagram
Equivalent
structured text
program.
Section 4.4
I0.4
I0.4
I0.4
I0.4
I0.4
I0.4
http://phenikaa-
uni.edu.vn
Normally Open Contact
http://phenikaa-
uni.edu.vn
Simulated NO instruction operation.
The Normally Closed Contact (NC)
instruction looks and operates like
a normally closed relay contact.
I0.4
I0.4
I0.4
I0.4
http://phenikaa-
uni.edu.vn
Simulated NC instruction operation.
Quiz
For the input module of
beside figure, the data
stored in the bit
corresponding to the open
switch would be ___ and
that for the closed switch
would be ___ respectively.
a) 1, 1
b) 0, 1
c) 0, 0
d) 1, 0
http://phenikaa-
uni.edu.vn
The Output instruction looks and operates like
a relay coil.
A true logic
path is
I0.1
established by
I0.4
the input
instructions in
the rung.
Simulated Output instruction
operation.
Action of the field device and PLC bit.
A signal
present
makes the
NO bit (1)
true; a signal
absent makes
the NO bit
(0) false. The
reverse is
true for an
NC bit.
Simulated operation of the field input
device and the PLC bit.
The main function of the ladder logic diagram
program is to control outputs based on input
conditions.
Each contact or coil symbol is referenced with an
address that identifies what is being evaluated and
what is being controlled.
instruction can be
used throughout the Q0.1
program whenever
I0.2 I0.4 Q0.2
that condition needs
to be evaluated.
For an output to be activated or energized, at least
one left-to-right true logical path must exist.
A complete closed
path is referred to
as having logical
continuity.
Branch Instructions
Branch instructions are used to create parallel
paths of input condition instructions.
Either A or B provides a
true logical path to all
three output instructions:
C, D, and E.
Additional input
instructions can be
programmed in the
output branches.
Simulated program, either A or B provides a true
logical path to all three output instructions: C, D,
and E.
Input and output branches can be nested to avoid
redundant instructions and to speed up processor
scan time.
It is possible, however,
to program a logically
equivalent branching
condition.
There may be limitations to the number of series
contact instructions that can be included in one
rung of a ladder diagram as well as limitations to
the number of parallel branches.
The PLC will not allow
for programming of
vertical contacts.
Reprogrammed to eliminate
vertical contact.
The processor examines the ladder logic rung for logic
continuity from left to right.
If programmed as shown,
contact combination
FDBC would be ignored.
Reprogrammed circuit.
Section 4.4.3
M0.3
M0.3
M0.3
Programming
Normally Open Contact and
Normally Closed Contact
Instructions
Normally Open Contact instruction