Technical data

Basics of Designing a Program Structure
4.2 Blocks in the User Program
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 91
Variables of the Data Type FB
If your user program is structured so that an FB contains calls for further already existing function
blocks, you can include the FBs to be called as static variables of the data type FB in the variable
declaration table of the calling FB. This technique allows you to nest variables and concentrate the
instance data in one instance data block (multiple instance).
Assigning Actual Parameters to the Formal Parameters
It is not generally necessary in STEP 7 to assign actual parameters to the formal parameters of an
FB. There are, however, exceptions to this. Actual parameters must be assigned in the following
situations:
For an in/out parameter of a complex data type (for example, STRING, ARRAY or
DATE_AND_TIME)
For all parameter types (for example TIMER, COUNTER, or POINTER)
STEP 7 assigns the actual parameters to the formal parameters of an FB as follows:
When you specify actual parameters in the call statement: the instructions of the FB use the
actual parameters provided.
When you do not specify actual parameters in the call statement: the instructions of the FB use
the value saved in the instance DB.
The following table shows which variables of the FB must be assigned actual parameters.
Data Type
Variable Elementary Data Type Complex Data Type Parameter Type
Input No parameter required No parameter required Actual parameter required
Output No parameter required No parameter required Actual parameter required
In/out No parameter required Actual parameter required