Technical data

Basics of Creating Logic Blocks
10.3 Multiple Instances in the Variable Declaration
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 247
10.3 Multiple Instances in the Variable Declaration
10.3.1 Using Multiple Instances
It is possible that you may want to or have to use a restricted number of data blocks for instance
data owing to the performance (for example, memory capacity) of the S7 CPUs you are using. If
other existing function blocks are called in an FB in your user program (call hierarchy of FBs), you
can call these other function blocks without their own (additional) instance data blocks.
Use the following solution:
Include the function blocks you want to call as static variables in the variable declaration of the
calling function block.
In this function block, call other function blocks without their own (additional) instance data
blocks.
This concentrates the instance data in one instance data block, meaning you can use the
available number of data blocks more effectively.
The following example illustrates the solution described: FB2 and FB3 use the instance DB of the
function block FB1 from which they were called.
Only requirement: You must "tell" the calling function block which instances you are calling and
what (FB) type these instances are. These details must be entered in the declaration window of the
calling function block. The function block used must have at least one variable or parameter from
the data area (VAR_TEMP cannot be used).
Do not use multiple instance data blocks if online changes are expected while the CPU is running.
Surge-free reloading is only guaranteed when using instance data blocks.