Function blocks
Function blocks are created in logiccloud via the project tree. Within the node POUs you can create a new function block. To do this, right-click or go to the icon with the three dots and select Add POU, assign a name, select as type Function block and as Language Structured Text (ST). The structure is created automatically.
FUNCTION_BLOCK (* optional_begin *) FINAL|ABSTRACT (* optional_end *) Name
(* optional_begin *) USING Namespace_1;USING Namespace_2; (* optional_end *)
(* optional_begin *) EXTENDS FB_name_1 (* optional_end *)
(* optional_begin *) IMPLEMENTS interface_1, interface_2, ... interface_n (* optional_end *)
(* optional: declaration of variables/instances *)
(* optional: declaration of methods *)
(* optional: body of function block *)
END_FUNCTION_BLOCKCalls of function modules
Section titled “Calls of function modules”FUNCTION_BLOCK Function Block_1VAR_INPUT INPUT_1: REAL; INPUT_2: REAL;END_VAR
VAR_OUTPUT OUTPUT: REAL;END_VAR
OUTPUT := INPUT_1 + INPUT_2;END_FUNCTION_BLOCKPROGRAM PRG
VAR_INPUT In1: REAL; In2: REAL;END_VAR
VAR_OUTPUT Out: REAL;END_VAR
VAR FB: Function block_1; // Instance of the function blockEND_VAR
FB( INPUT_1 := In1, INPUT_2 := In2, OUTPUT => Out);
END_PROGRAM