4.4.3.7 Blocks
All IEC 61131-3 block types are suitable for creating safety-oriented applications:
n PROGRAM
n FUNCTION
n FUNCTION_BLOCK
If blocks are used the following programming guidelines should be followed:
n Functions and function blocks must not affect global application states. This can be achieved through
write access to global data and by calling system components.
n Explicit parameter transfer is preferable for calling programs and function blocks.
Bad:
Inst.Param1 := 7;
Inst.Param2 := 3;
Inst();
X := (Inst.Out1 AND A) OR B;
Good:
Inst(Param1 := 7, Param2 := 3, Out => Result);
X := (Result AND A) OR B;
n All input parameters should be assigned for a call.
Configuration and programming
CoDeSys Safety programming guidelines > Language-specific programming guidelines
30.03.2017AC500-S216