Getting Started with Trace¶
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);
In the device tree, select the application and add a new trace object by clicking
.- ⇒
The respective trace editor opens with the commands available in the
menu.
Click
.- ⇒
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
.- ⇒
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
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 instructions for “Getting Started”, CODESYS displays the following trace diagram.
- : Configuration
- : Add variable
See also