Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
622 Manual, 05/2010, A5E02789666-01
27.3.4.7 Assigning Data Types to Local Data of Logic Blocks
With STEP 7, the data types (elementary and complex data types and parameter types) that can
be assigned to the local data of a block in the variable declaration are restricted.
Valid Data Types for the Local Data of an OB
The following table illustrates the restrictions (--) for declaring local data for an OB. Since you
cannot call an OB, an OB cannot have parameters (input, output, or in/out). Since an OB does not
have an instance DB, you cannot declare any static variables for an OB. The data types of the
temporary variables of an OB can be elementary or complex data types and the data type ANY.
The valid assignments are shown by the z symbol.
Declaration
Type
Elementary
Data Types
Complex
Data Types
Parameter
Type
Parameter
Type
Parameter
Type
Parameter
Type
Parameter
Type
TIMER COUNTER BLOCK POINTER ANY
Input -- -- -- -- -- -- --
Output -- -- -- -- -- -- --
In/out -- -- -- -- -- -- --
Static -- -- -- -- -- -- --
Temporary z(1)
z(1)
-- -- -- -- z(1)
(1)
Located in the L stack of the OB.
Valid Data Types for the Local Data of an FB
The following table illustrates the restrictions (-) for declaring local data for an FB. Due to the
instance DB, there are less restrictions when declaring local data for an FB. When declaring input
parameters there are no restrictions whatsoever; for an output parameter you cannot declare any
parameter types, and for in/out parameters only the parameter types POINTER and ANY are
permitted. You can declare temporary variables as the ANY data type. All other parameter types
are illegal.
The valid assignments are shown by the z symbol.
Declaration
Type
Elementary
Data Types
Complex
Data Types
Parameter
Type
Parameter
Type
Parameter
Type
Parameter
Type
Parameter
Type
TIMER COUNTER BLOCK POINTER ANY
Input
z z z z z z z
Output
z z
-- -- -- -- --
In/out
z
z(1)(3)
-- -- --
z z
Static
z z
-- -- -- -- --
Temporary z(2)
z(2)
-- -- -- -- z(2)
1
Stored as a reference (48-bit pointer) in the instance data block.
2
Located in the L stack of the FB.
3
STRINGS can be defined in the default length only.