|
Tip |
|---|---|
|
The |
Syntax
<boolean variable name> := INI ( <FB instance name> , <boolean value> ); // <boolean value> : TRUE | FALSE
With the INI operator, you can trigger the initialization of retain variables of a function block instance used in a POU.
If the second parameter of the operator is TRUE, then CODESYS initializes all retain variables which are defined in the function block <FB instance name> and then returns TRUE.
Example 165. Example in ST
fbinst is the instance of the function block fb1, where the retain variable retvar is defined.
VAR
fbinst : fb1;
b : BOOL;
END_VAR
b := INI(fbinst, TRUE);
ivar := fbinst.retvar; (* => retvar is initialized *)
Example in FUP
For more information, see: RETAIN, Preserving Data with Retain Variables