Attribute ‘call_on_type_change’¶
With this pragma, you can mark a method of a function block A that should be called when the data type changes for one or more function blocks B, C, etc. that are referenced by A. The referencing can be defined by a pointer variable or a REFERENCE
variable.
Syntax:
{attribute 'call_on_type_change':= '<name of the first referenced function block>|<name of the second referenced function block>|<name of the ... referenced function block>'}
Insert location: Line above the first line in the method declaration.
Example
Function blocks with references
FUNCTION_BLOCK FB_A
...
VAR
\ var_pt: POINTER TO FB_B;
\ var_ref: REFERENCE TO FB_C;
END_VAR
...
Method for reaction to a type change in the references FB_B and FB_C
\
{attribute 'call_on_type_change' := 'FB_B, FB_C'}
METHOD METH_react_on_type_change : INT
VAR_INPUT
...