Getting Started Permalink

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

  1. In the device tree, select the application and click “Project  Add Object” to add a new trace object.

    The corresponding trace editor opens with the commands available in the “Trace” menu.

  2. Click “Trace  Configuration”.

    The “Trace Configuration” dialog 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.

    Example: ‎PLC_PRG.rSin‎

  5. Click “Trace  Download Trace”.

    CODESYS downloads the trace configuration to the controller. The application starts the data sampling and transfers the data to CODESYS. Then they are displayed as a graph in the trace diagram. Commands are provided for navigating through the samples and controlling the data sampling.