Debugging ST programs
For Structured Text (ST) programs, generate debug information for individual program organization units (POUs) to enable step-by-step execution while simulating an application. For ST programs in a resource with generated debug information, the controller switches to step-by-step execution when the application encounters a breakpoint. Set breakpoints to lines of code to instantiate step-by-step execution.
TIP:
Breakpoints, cycle-to-cycle, and step-by-step execution
are only available while simulating an application.
In the language editor, breakpoints appear as red circles to the left of the line of code
and the line is highlighted in red.

While debugging, the application stops when it encounters a breakpoint. At this time, the application is in the DEBUGGING state. Perform one of these operations:
- Step into the line of code, execute the current line of code then steps into the subsequent line of code. When the current line of code includes a call to a function, stepping continues in the called function then returns to the line of code in the POU.
- Step over the line of code, execute the current line of code then steps to the next line of code
- Execute in real-time mode
- Execute one cycleTIP: Set breakpoints for Target-independent code (TIC); C source code POUs do not support breakpoints.
When the application stops on a breakpoint, a yellow arrow appears over the breakpoint and the line of code is highlighted pink.

The arrow points downward when stepping passes beyond the last line of code of a POU.
Task | Procedure | ||
Generate debug information for an ST POU |
| ||
Set a breakpoint |
| ||
Remove a breakpoint |
| ||
Step into the line of code |
| ||
Step over the line of code |
| ||
Execute in real-time mode |
| ||
Execute in cycle-to-cycle mode |
| ||
Execute one cycle |
|
TIP:
Set or remove breakpoints in the RUNNING state or
cycle-to-cycle execution while simulating.
Provide Feedback