3 General Programming
3.4 Storage concept
Figure 3-15: Copying of the value to the input parameter
„My_int"
value: 31
Properties
Each block displays the same behavior with connected parameters
Values are copied when calling the block
3.3.2
Call-by-reference with InOut interface type
When calling the block the address of the actual parameter of the Input parameter
is referenced for the InOut interface type. For this, no additional memory is
required.
Figure 3-16: Referencing the value (pointer to data storage of the parameter)
"My_string"
value: 'test'
Properties
Each block displays the same behavior with connected parameters
Actual parameters are referenced with the block call
Recommendation
Generally use the InOut interface type for structured tags (e.g. of the ARRAY,
STRUCT, STRING, type...) in order to avoid enlarging the required data
memory unnecessarily.
3.4
Storage concept
For STEP 7 there is generally the difference between the global and local memory
area. The global memory area is available for each block in the user program. The
local memory area is only available within the respective block.
3.4.1
Block interfaces as data exchange
If you are encapsulating the functions and program the data exchange between the
blocks only via the interfaces, you will clearly have advantages.
Programming Guideline for S7-1200/1500
V1.2, Entry ID: 81318674
FC / FB
IN
value: 31
FC / FB
IN/OUT
Reference to "My_string"
41