Monitoring in Programming Objects

You have loaded a project into the controller and started it.
You wish to observe the current values that the variables on the controller adopt in the TwinCAT development system in the editors of the programming blocks.
1. Make sure that the option Enable inline monitoring is activated in the menu Tools > Options in the category TwinCAT > PLC Environment > Text editor on the tab Monitoring.
2. Select the command Decimal in the menu PLC > Display Mode to set the display format of the values.
3. Double-click on the POU in the PLC project tree in the Solution Explorer to open the associated editor.
You can see the representations of the variable values in the declaration part and implementation part. And you will find a general description of this plus the special features that depend on the type of POU and the programming editor.

Monitoring in the declaration editor

The current value of a variable is displayed in the column Value. You can write and force the value entered in the column Prepared value. Forced values are preceded by a red symbol Monitoring in Programming Objects 1:.

Monitoring in Programming Objects 2:

The printout of an interface reference is expandable. If the interface points to a global instance, this global instance is displayed as the first entry under the reference. If the interface reference changes afterwards, the displayed reference collapses.

See also:

Monitoring in implementation (inline monitoring)

The display of the current variable value in the implementation part is called inline monitoring. The following displays are possible, depending on the programming language:

Monitoring in the ST editor:

Monitoring in Programming Objects 5:

Monitoring in the LD editor:

Monitoring in Programming Objects 6:

Monitoring in the SFC editor:

Monitoring in Programming Objects 7:
Monitoring in Programming Objects 8:

You can deactivate the inline monitoring function here: Menu Tools > Options, Category TwinCAT > PLC Environment > Text editor, Tab Monitoring.

See also:

Partially monitor array

An array that is expanded shows the actual values for up to 1000 elements. This can be confusing. Moreover, an array can contain more than 1000 elements. Then it is helpful to limit the range of displayed elements. You can do this during online operation in the following ways.

You have loaded a project on the controller in which a multi-dimensional array variable with more than 1000 elements is declared.
Sample: aSample : ARRAY [1..100, 1..10, 1..20] OF INT;
1. For the variable aSample, click in the field of the column Data type.
The Monitoring area dialog opens.
2. Enter the value [1, 0, 0] at Start.
3. Enter the value [1, 10, 20] at End.
The actual values of 200 array elements are displayed. The range is limited to elements of index [1, <i>, <j>].

Monitoring a function block

If you are about to open an editor view for a function block in online mode, you will be asked whether you wish to open the view of the basic implementation or an instance of the function block. Monitoring is only possible in the basic implementation if a breakpoint is set. If you set a breakpoint in the basic implementation, it will be set in all instances. The values of the instance that is executed first in the program sequence are displayed first in the basic implementation view.

If you double-click on the editor view of a function block during online operation, a dialog appears in which you can choose between the view of the basic implementation or a specific instance.

If you select the basic implementation, then the code appears in the editor without displaying current values. Now set a breakpoint in the basic implementation. If the execution stops there, the current values of that instance are displayed which is processed first in the program flow. You can now step successively through all instances.

If you select one of the instances, then the editor with the code of the function block instance opens. The current values are displayed and constantly updated in the declaration and, if necessary, in the implementation.

See also:

Monitoring the property

You can monitor variables in a property object Monitoring in Programming Objects 9: when you set a breakpoint during online operation. When stopped there, the current values are displayed.

In addition to its own values, the values of the variables of the higher-level instance are automatically displayed. In the declaration part of the property, the pointer THIS appears in the first line, pointing to the higher-level instance, with the data type specifications and current values.

Monitoring in Programming Objects 10:

See also:

Monitoring the property access in the higher-level programming object

You can monitor the values of lower-level properties Monitoring in Programming Objects 11: in a function block or program in addition to the variable values.

To do this, insert either the pragma {attribute 'monitoring' = 'variable'} or the pragma {attribute 'monitoring' = 'call'} to the lower-level property object in the declaration. If you open the higher-level program or the higher-level function block instance at runtime, then the current property values are displayed in the editor in addition to the current variable values.

See also:

Monitoring the method

You can monitor variables in a method object Monitoring in Programming Objects 12: if you set a breakpoint in the method during online operation. When stopped there, the current values are displayed.

In addition to its own values, the values of the variables of the higher-level instance are automatically displayed. In the declaration part of the method, the pointer THIS appears in the first line for this purpose, which points to the higher-level instance, with the data type specifications and current values.

Monitoring in Programming Objects 13:

See also:

Monitoring the function

You can monitor variables in a function object if you set a breakpoint in the function during online operation. When stopped there, the current values are displayed.

Monitoring the return value of a function call

In the ST editor, the current return value of a function is displayed in the inline monitoring instead of a POU at which the function is called if the following is satisfied:

See also: