CFC Editor in Online Mode

In the CFC editor, you can monitor and change variable values in the controller in online mode. In addition, debugging features are provided in CODESYS, such as breakpoints and stepping.

Monitoring

Monitoring in the declaration section works like in all of the implementation language editors. For more details, see the “Monitoring” help file.

In the online view of a function block, please note that monitoring is possible only in the instance view. No values are shown in the view for the base implementation.

The values of Boolean connections have different colors: TRUE = blue, FALSE = black.

Forcing and writing variables

In online mode, you can prepare a value in the declaration editor for forcing or writing a monitored variable. For more details, see the “Monitoring Values” help file.

When you select the Prepare values in implementation part check box in the CFC Editor category of the CODESYS options, you can also prepare values in the implementation section. To do this, open the Prepare Value dialog box by double-clicking an element or the monitoring box next to an element. For Boolean variables, a dialog box does not open. Instead, clicking the value next to the variable toggles between the possible values for forcing and writing. The prepared value is shown in angle brackets.

After executing a write or a force, a red “F” is shown in the monitoring box.

Changing constant input parameters of function block instances

You can also change input parameters of VAR_CONSTANT function block instances in online mode to adjust the parameters. After logging out, you save these parameters by clicking Save prepared Parameters to Project.

Requirement: A CFC editor is active. An instantiated function block has VAR_INPUT CONSTANT variables in its declaration.

  1. In the editor, open the POU with the call to function block instance.

  2. Log back in to the controller.

  3. Click the Parameters field of the function block instance.

    366f47e4fe527833c0a8640e019220f9_22a9bf5ee52aee15c0a8640e008128cf

    The Edit Parameters dialog box opens.

  4. Click the Value column in an inline monitoring field of a parameter.

    The Prepare Value dialog box opens.

  5. Type a new value in the Prepare a new value for the next write or force operation field.

  6. Click OK.

    The prepared value is shown in angle brackets next to the current value (for example, <710>).

    366f47e4fe527833c0a8640e019220f9_297898d6e52ba214c0a8640e01485726

  7. Write the prepared value by clicking Debug ‣ Write Value.

    The parameter is changed and shown in the project in brackets after the value.

    366f47e4fe527833c0a8640e019220f9_6920feade52bf614c0a8640e0105da94

    The difference between both values is shown by a red cross next to the parameter field of the function block instance.

    366f47e4fe527833c0a8640e019220f9_c95c507be52b4810c0a8640e00523242

  8. Click Edit Parameters to close the dialog box.

  9. Log out.

  10. Click CFC ‣ Save Prepared Parameters to Project.

    The change parameter values are saved to the project. The asterisk next to the parameter field disappears.

See also

Breakpoint positions in the CFC editor

As a rule, you can set breakpoints in a block anywhere variables can change, as well as locations where the program flow branches off or another block is called. In the following figure, the red circles show possible breakpoint locations.

../_images/0ce7111c7928fd09c0a8640e017c06a1

Attention

A breakpoint is set automatically in all methods that can be called.

Therefore, if a method is called that is defined over an interface, then breakpoints are set in all methods of function blocks that implement this interface. This also applies to all inherited function blocks that define methods.