Skip to main content

Getting Started with Trace

Create a project with the following program PLC_PRG:

                    PROGRAM PLC_PRG
                    VAR
                    iVar : INT;
                    rSin : REAL;
                    rVar : REAL;
                    END_VAR

                    iVar := iVar + 1;
                    iVar := iVar MOD 33;

                    rVar := rVar + 0.1;
                    rSin := 30 * SIN(rVar);
                
  1. In the device tree, select the application and add a new visualization by clicking Project → Add Object → Visualization.

    The corresponding visualization editor opens.

  2. Add the Visualization object to the device tree below Application.

    An empty visualization appears.

  3. Click ToolBox → Special Controls.

  4. Drag the Trace element to the visualization editor.

    The properties of trend element are displayed on the right side.

  5. Click the _visu_icon_trace.png symbol in the Trace property.

    The Trace Configuration dialog opens.

  6. Click Add Variable to add an entry to the tree view of the trace configuration and select a project variable (for example, PLC_PRG.rSin).

  7. Click the top node of the trace configuration.

    The group Record Settings is shown on the right.

  8. Select the MainTask option for the Task setting.

    Hint: The trace record and the corresponding program should be executed in the same task.

  9. Click OK.

    The task configuration is applied.

  10. Select the trace element and click Visualization → Insert Elements for Controlling Trace.

    The Trace Wizard dialog opens. By default, all controls are activated there.

  11. Click OK to exit the dialog.

    The controls are added to the visualization and the control variables are declared. Then the controls and the trace element are configured with the control variables.

  12. Download the application to the controller and start it.

Example

Example 15. Record the sine-shaped data of the IEC variable PLC_PRG.rSin

The PLC_PRG program is running on the controller. When you follow the "Getting Started" instructions, the following interface is displayed:

_visu_img_trace_example.png

You can control the trace record by clicking the buttons.