Technical data

Basics of Designing a Program Structure
4.2 Blocks in the User Program
Programming with STEP 7
80 Manual, 05/2010, A5E02789666-01
4.2.2 Call Hierarchy in the User Program
For the user program to function, the blocks that make up the user program must be called. This is
done using special STEP 7 instructions, the block calls, that can only be programmed and started
in logic blocks.
Order and Nesting Depth
The order and nesting of the block calls is known as the call hierarchy. The number of blocks that
can be nested (the nesting depth) depends on the particular CPU.
The following figure illustrates the order and nesting depth of the block calls within a scan cycle.
There is a set order for creating blocks:
You create the blocks from top to bottom, so you start with the top row of blocks.
Every block that is called must already exist, meaning that within a row of blocks the order for
creating them is from right to left.
The last block to be created is OB1.
Putting these rules into practice for the example in the figure produces the following sequence for
creating the blocks:
FC1 > FB1 + instance DB1 > DB1 > SFC1 > FB2 + instance DB2 > OB1
Note
If the nesting is too deep (too many levels), the local data stack may overflow (Also refer to Local Data
Stack).