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);
Requirement: The application is running the PLC_PRG
program on the controller.
-
In the device tree, select the application and add a new trace object by clicking “Project Add Object”.
The respective trace editor opens with the commands available in the “Trace” menu.
-
Click “Trace Configuration”.
The “Trace Configuration” dialog box opens.
-
Select a task for running the trace feature. Normally this is the same task that is running in PLC_PRG.
-
Click “Add Variable” to add an entry to the tree view of the trace configuration and assign an IEC variable (for example,
PLC_PRG.rSin
). -
Click “Trace Download Trace”.
CODESYS loads the trace configuration to the controller. The application starts recording data and transmits the data to CODESYS, where it is displayed in the trace diagram as a graph. Commands are provided for navigating through the samples and controlling the data recording.
Example
Trace the sine-shaped data of the IEC variable PLC_PRG.rSin
The PLC_PRG
program is running on the controller. When you follow the instructions for "Getting
Started", CODESYS displays the following trace diagram.

-
(1) : “Configuration”
-
(2) : “Add Variable”
See also