Operator ‘INI’¶
Note
The INI
operator is a CoDeSys V2.3 operator. In CODESYSV3, the FB_init
method replaces the INI
operator. You can still use this operator in projects that are imported from CoDeSys V2.3.
The INI
operator is used for initializing retain variables of a function block instance used in a POU.
Assign the operator to a Boolean variable.
<Boolean variable> := INI(<FB instance, TRUE\\\|FALSE)
If the second parameter of the operator yields TRUE
, then CODESYS initializes all retain variables that are defined in the FB function block.
Examples
fbinst
is the instance of the function block fb1
, where the retain variable retvar
is defined.
ST:
Declaration in block:
VAR
\ fbinst : fb1;
\ b : BOOL;
END_VAR
Program part:
b := INI(fbinst, TRUE);
ivar := fbinst.retvar; (* => retvar is initialized *)
FBD
See also