Skip to main content

Attribute: initialize_on_call

The pragma causes input variables of a function block to be initialized on each call of the function block. If an input variable is affected which expects a pointer and this pointer has been removed during an online change, then the variable is initialized to zero.

Syntax:

{attribute 'initialize_on_call'}

Insert location: Always in the first line of the declaration part for the entire function block, and also in a line above the declaration of the individual input variable.

Example 271. example
{attribute 'initialize_on_call'}
FUNCTION_BLOCK fb
VAR_INPUT
    {attribute 'initialize_on_call'}
    pInt : POINTER TO INT := 0;
    {attribute 'initialize_on_call'}
    iVal : INT := 0;
END_VAR