Attribute monitoring
This attribute pragma allows you to get properties and function call results monitored in the online view of the IEC editor or in a watch list.
Add the pragma in the line above the property definition. Then the name, type, and value of the variables of the property will be displayed in the online view of the POU using the property or in a watch list. Therein, you can also enter prepared values to force variables belonging to the property.
Example of property prepared for variable monitoring
Example of monitoring view
There are two different ways to monitor the current value of the property variables. For the particular use case, consider carefully which attribute is suitable to actually get the desired value. This will depend on whether operations on the variables are implemented within the property:
1. Pragma {attribute 'monitoring':='variable'}
An implicit variable is created for the property, which will get the current property value whenever the application calls the set or get method. The latest value stored in this implicit variable will be monitored.
Syntax
{attribute 'monitoring':='variable'}
2. Pragma {attribute 'monitoring':='call'}
You can only use this attribute for properties returning simple data types or pointers, not for structured types.
The value to be monitored is read or written by a direct call of property: the monitoring service of the runtime system executes the Get
or Set
method of the property function including the implementation part of the property.
Syntax
{attribute 'monitoring':='call'}
You can use function call monitoring for any constant value that can be interpreted as 4 byte numerical value (for example, INT, SHORT, LONG). For the other input parameters (for example, BOOL), use a variable instead of a constant parameter. Add the pragma {attribute 'monitoring':='call'}
in the line above the function declaration. You can then monitor this variable in the text editor view in online view of the POU in which a variable gets assigned the result of a function call. You can also add the variable to a watch list for the same purpose. To get the variable immediately provided within a watch view, execute the command .
Example 1: Functions FUN2
and FUN_BOOL2
with attribute 'monitoring'
Example 2: Call of functions FUN2
and FUN_BOOL2
in a program POU
Example 3: Function calls in online mode:
For monitoring variables with an implicit call of an external function, the following conditions have to be fulfilled:
The function is marked with {attribute 'monitoring' := 'call'}
.
The function is marked as
.
The variable is marked with {attribute 'monitoring_instead' := 'MyExternalFunction(a,b,c)'}.
The values a,b,c
are integer values and match the input parameters of the function to call.