S5-115F Manual
2.2.2
Structured Programming
To solve complex tasks, it is advisable to divide an entire program into individual, self-contained
parts (blocks).
This procedure has the following advantages:
•
Simple and clear programming, even for large programs
•
Capability to standardize program parts
•
Easy alteration
•
Simple program test
•
Simple start-up
•
Subroutine techniques (block call from different locations)
The STEP 5 programming language has the following five block types:
•
Organization block (OB)
Organization blocks manage the control program.
•
Program block (PB)
Program blocks arrange the control program according to functional or technological aspects.
•
Sequence block (SB)
Sequence blocks are special blocks that program sequence controls. They are handled like
program blocks.
•
Function block (FB)
Function blocks are special blocks for programming frequently recurring or especially complex
program parts (e.g. reporting and arithmetic functions). You can assign parameters to them.
They have an extended set of operations (e.g. jump operations within a block).
•
Data block (DB)
Data blocks store data needed to process a control program. Actual values, limiting values,
and texts are examples of data.
The program uses block calls to exit one block and jump to another. You can therefore nest
program, function, and sequence blocks randomly in up to 16 levels.
Note
When calculating the nesting depth, note that the system program itself can call an
organization block under certain circumstances.
The total nesting depth is the sum of the nesting depths of all programmed organization blocks. If
nesting goes beyond 16 levels, the PLC goes into the "STOP" mode with the error message
"STUEB" (block stack overflow) ( 5.1.2).
EWA 4NEB 811 6149-02
Introduction to STEP 5
2-5