Skip to main content

Testing and Debugging

For more information see: CODESYS Development System: Testing and Debugging

Writing and forcing

You can write variables one time in online mode or force them permanently to a predefined value.

If the variable is currently forced, then this is indicated directly before the forced value by _cds_icon_forced_variable.png. If a value has been prepared for writing or forcing, then this value is displayed directly after the actual value in angled brackets <value>.

Example 7. Example

Forced variable

_cds_img_il_force_variable.png

Prepared value

_cds_img_il_prepared_value.png


Setting breakpoints

Possible positions for breakpoints are in principle the positions where the values of variables can change (instructions), where the program branches, or where another box is called.

. Possible breakpoint positions
  • On the entire network

    Causes the breakpoint to be set at the first possible position in the network

  • On a box when the box contains an assignment

    Not possible with operator boxes (example; ADD, DIV)

  • On assignments

  • At the end of the box at the position of the return to the calling box

    In online mode, an empty network automatically opens here. It is indicated by "RET" in place of a network number.

Important

Currently, you cannot directly set a breakpoint on the first box in the network. However, if you set a breakpoint on the entire network, then in online mode this breakpoint indication is automatically transferred to the first box.

Important

Breakpoints in methods: CODESYS automatically sets a breakpoint in all methods which can be called. Therefore, if a method managed by an interface is called, then breakpoints are set in all methods which occur in function blocks that implement this interface as well as in all derived function blocks that use the method. If a method is called by a pointer to a function block, then CODESYS sets the breakpoints in the method of the function block and in all derived function blocks that use the method.

Flow Control

When flow control is enabled, the values of variables as well as the results from function calls and operations are displayed at the respective processing location and time. In this way, the networks which process the current cycle are highlighted in color.

For more information, see: CODESYS Development System: Flow Control

Display in LD

  • The flow control positions of the run code parts passed are displayed as green fields.

  • On the left side, bars in green (or another flow control color) indicate running networks. Green connecting lines indicate connections which have been run through.

  • The actual value of the connection is also highlighted in color: TRUE by a bold blue line, FALSE by a bold black line, and unknown or analog values by thin black lines. Combinations of these lines are displayed as dashed lines.

_cds_img_flowcontrol_ld.png

Display in IL

In IL, the actual values are displayed in two fields for each instruction. A field is to the left of the operator with the current accumulator value. The second field is to the right of the operand with the operand value.

_cds_img_flowcontrol_il.png

You can write values in the declaration part and in the implementation part. Values are written at the end of the current cycle. Forcing is not possible.