The INI
operator is a CoDeSys V2.3 operator. In CODESYS V3, 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.
Syntax:
<Boolean variable name> := INI <FB instance name> , <Boolean value> ); <Boolean value> : TRUE | FALSE
If the second parameter of the operator yields TRUE
, then CODESYS initializes all retain variables that are defined in the function block <FB instance name>
.
Examples
fbinst
is the instance of the function block fb1
, where the retain variable retvar
is defined.
ST:
Declaration in the block: VAR fbinst : fb1; b : BOOL; END_VAR Program part: b := INI(fbinst, TRUE); ivar := fbinst.retvar; (* => retvar is initialized *)
FBD
