A Function_Block is a sequence of statements executed in order with state information preserved between executions.
A Function Block uses this syntax:
function-block ::=
FUNCTION_BLOCK function-block-name
{ variable-declaration }
[ function-block-code ]
END_FUNCTION_BLOCK
function-block-code ::= [ structured-text | instruction-list ]
Where:
Use any of the following for the function-block-code:
A Function Block can call another Function or Function Block.
(* Rising edge detector *) Function_Block R_TRIG Var_Input CLK : Bool; End_Var Var_Output Q : Bool; End_Var Var M : Bool := False; End_Var Q := CLK AND NOT M; M := CLK; End_Function_Block
IEC 61131-3 Second Edition: Table 33.
IEC 61131-3 Third Edition: Table 40.
To learn about other program units.
To learn about variable declarations.
To learn about ST Statements.
For the meaning of terms used in Fernhill SCADA.