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);
  1. 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.

  2. Click Trace ‣ Configuration.

    The Trace Configuration dialog box opens.

  3. Select a task for running the trace feature. Normally this is the same task that is running in PLC_PRG.

  4. 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).

  5. 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

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.

../_images/d61b176ded076292c0a8640e003068b9
    1. : Configuration
    1. : Add variable

See also