INI Operator

The INI operator can be used to initialize retain variables which are provided by a function block instance used in the POU.

The operator must be assigned to a boolean variable.

Syntax: <bool-Variable> := INI(<FB-instance, TRUE|FALSE)

If the second parameter of the operator is set to TRUE, all retain variables defined in the function block FB will be initialized.

Example in ST:

fbinst is the instance of function block fb, in which a retain variable retvar is defined.

Declaration in POU:

fbinst:fb;
b:bool;

Implementation part:

b := INI(fbinst, TRUE);
ivar:=fbinst.retvar  (* => retvar gets initialized *)

Example of operator call in \ IL:

LD fbinst
INI TRUE
ST b

Example of operator call in FUP:

../_images/7cf47d1c437580f50a33139006eab46b