3 General Programming
3.3 Block interface types
When every block receives an independent task, a clear and well-structured
user program is automatically created.
There are clearly fewer sources of errors
Simple error diagnostic possible.
Recommendation
If you want to reuse the block, please note the following recommendations:
Always look at blocks as encapsulated functions. I.e. each block represents a
completed partial task within of the entire user program.
Use several cyclic Main OBs to group the plant parts.
Always execute a data exchange between the blocks via its interfaces and not
via its instances (see chapter 3.4.1 Block interfaces as data exchange).
Do not use project-specific data and avoid the following block contents:
–
Access to global DBs and use of individual instance DBs
–
Access to tags
–
Access to global constants
Reusable blocks have the same requirements as know-how-protected blocks
in libraries. This is why you have to check the blocks for reusability based on
the "Block can be used as know-how protected library element" block property.
Compile the block before the check.
Figure 3-14: Block attributes
3.3
Block interface types
FBs and FCs have three different interface types: In, InOut and Out. Via these
interface types the blocks are provided with parameters. The parameters are
processed and output again in the block. There are two different options for this
parameter transfer.
3.3.1
Call-by-value with In interface type
When calling the block, the value of the actual parameter is copied onto the input
parameter of the block for the In interface type. For this, additional memory is
required.
Programming Guideline for S7-1200/1500
V1.2, Entry ID: 81318674
40