“DEBUG” Tab

The “DEBUG” tab contains functions for executing and checking the source code.

“DEBUG” Tab
“DEBUG” Tab

The “DEBUG” tab contains the following operating elements:

“DEBUG” Operating Elements

Button

Description

“Connection” Group

Connect

Opens an online connection to one or several selected devices.

The CODESYS application is connected with the target system. An ongoing online simulation is closed.

The status of the button depends on the devices selected: “Connect” if no device is connected, “Disconnect” if all selected devices are connected. If the selected devices have different connection states, all devices are disconnected on the first click and connected with a second click.

Connection requirements:

- error-free program compilation
- correctly configured communication device settings

Connection to the selected device (login) is performed for all applications.

A download is executed, if necessary.

Disconnect

Disconnects the development and target systems (controller or simulated device) and returns to offline mode

"Execute" Group

Simulate application

Can be selected if there is no online connection; starts Simulation mode.

The mode starts and debugs an application on a simulated target device in order to test the online behavior of an application in advance without requiring the actual device. No communication settings are required for the simulated device.

When a function is called for the first time, a prompt asks whether the application is to be created or loaded.

An active simulation mode is displayed in the message bar and in the “Messages” panel.

Close simulation

Closes the simulation mode;

the simulation is also closed if the [Connect] button is clicked.

Start

Starts the application on the controller or in the simulation

Stop

Stops the application on the controller or in the simulation

Single cycle

Performs one cycle of the active application

“Breakpoints” Group

New

Sets a breakpoint at the current position within the active code editor (see Breakpoints)

Toggle

Toggles between the active and inactive state of a breakpoint.

This also causes the setting of a new breakpoint (if not yet set at the current breakpoint position).

Active breakpoints are deactivated after online mode is closed or after logging in again (see Breakpoints).

“Increment” Group

Step Over

Executes a program in online mode in defined steps, e.g., for debugging.

With instructions on one level, this corresponds to “stepping” with the “Step Into” command (see next command).
When a function block call is reached, the entire function block is performed in a single step.
A complete action is processed in a sequential function chart.

Single Into

Executes a program in online mode in defined steps, e.g., for debugging.

A single step is performed.
If necessary, the program switches to another program organization unit (POU). If the current position is a function call or function block call, the program stops in front of the first instruction of the called function block. In all other situations, the command has the same function as the “Step Over” command.
Possible stop positions during step-by-step processing depend on the type of editor. The current position is highlighted in yellow.

Step Out

Steps a program backward

In the case of a nested program code, the backward step is made through the calls.
This causes a return to the start of the program if the program does not contain any calls.
It also causes a return to the calling instruction if the program had jumped previously to a called function block.

Run to Cursor

Runs the program from the current position to a temporarily definable position

For this the cursor is placed at the required stop position before performing the command.

Set Next Statement

Sets the statement to be executed next; to do this, the cursor is placed in this instruction before executing the command.

Show Current Statement

This returns the cursor in online mode to the current execution position if the stepwise processing had moved the cursor to another position in the user interface.

“Values” Group

Monitoring

Opens a selection field with the commands “Monitoring 1, 2, 3, 4” or “View all forced values”, which display the relevant watch list.

“View all forced values” is a special view of all currently forced values. It enables program organization units (POUs − program organization units of type program, function or function block) and a user-defined list of expressions/variables to be monitored.

Write

Sets the corresponding variable in the controller at the start of the next cycle once to the value defined for it in the programming software.

The command is applied to all variables of the active application that are prepared for writing

Force

If the controller is connected (online), the Force Values command causes one or several expressions/variables of the active application to be set permanently to defined values, i.e., they are not overwritten while the program is running.

This command is available in online mode ([F7]).

Unforced values

Removes the forcing of all variables of the active application in online mode.

Forcing is also removed by disconnecting the controller from the programming system. The variables are then assigned their current value from the controller.

“Settings” Group

Display Mode

Sets the number format of variable values.

The following can be selected: decimal, hexadecimal, binary.

Flow Control

Switches the flow control in online mode on or off for the language editors ST, FBD, LD and CFC;

an activated flow control enables program processing to be followed in the editor window. Current variables, and thus the results of function calls and operations in the current cycle, are highlighted at the relevant processing position and time.

The flow control functions in all currently visible sections of the currently opened editor window.

Values cannot be written or forced in the flow control. This can only be performed in the declaration section.

Note: Activating the flow control increases the application runtime.

Note

Be aware of dangers resulting from writing or forcing values!

Abnormally changing a value in an application running on the controller may cause undesired behavior of the controlled system.
Evaluate any possible dangers resulting from writing or forcing variable values and take appropriate safety precautions. Depending on the system controlled, there is a risk of damage to the system and equipment or danger to people.

For additional information see: