Debugging
In addition to the cycle by cycle execution mode, the debugger has a rich collection of powerful features for making step by step debugging in the source code of your application.
Hint: If there is only one instance of the UDFB when the user changes into debug mode, the single instance name will be attached to the UDFB and the instance will be debugged automatically. Additonally it is possible to open several instances of the same UDFB. Double-click on an UDFB with instances opens a dialog to select, which instance should be debugged. If there is a change from online mode to edit mode all unused UDFBs are closed. In the edit mode it is only possible to open the same UDFB only one time.
Step by step debugging
The step by step feature is completed by the possibility to place breakpoints in the source code of the application. The debugger also shows you the call stack of called UDFBs and sub-programs when stepping. Step by step debugging is available:
- In ST and IL text programs (a step is a statement).
- In LD program (a step is a rung).
- In FBD (a step is a graphic symbol corresponding to an action).
|
|
Here are two possibilities for entering the step by step debugging mode:
- Place a breakpoint in a program (using the Build / Set-Remove Breakpoint command). When the breakpoint is reached, the execution stops at the specified location and you can step further in the program.
- When the target is in cycle stepping mode (STOP), you can step at the beginning of the first program.
The following commands are available for stepping, either from the main control panel, or from the Build menu of editors:
Command Icon |
Description |
|
Step over: If the next instruction is a call of a function block or a sub-program, the execution continues up to the end of the called block. |
|
Step in: If the next instruction is a call of a function block or a sub-program, the next step will be at the beginning of the called block. |
|
Step out: If the current stepping position is in a called function block or a sub-program, the execution continues up to the end of the block. |
In addition to these commands, you can at any time:
- Execute the cycle (from the current position up to the end of the last program).
- Restart the target in normal execution mode (RUN).
Breakpoints
To put or remove a breakpoint in a program, use the Build / Set-Remove Breakpoint menu command. If the current position is not on a valid line for stepping, the breakpoint is automatically moved to the nearest valid position.
Breakpoints can be placed in programs, sub-programs or UDFBs. They are not available in SFC programs.
You can see the list of active breakpoints in the Log Window or in the output window of an editor. From here you have the possibility to remove all breakpoints in a single command. At any moment you can double-click on a breakpoint in the Log window to open the corresponding program at the breakpoint location.
Run To Selection
It is possible to run a program to a defined position. The Run To Selection function is available in the context menu of the program editor, when step-by-step execution is active. This function is supported in ST, FBD and LD.
The call stack
When stepping, the Call Stack is available in the Log Window or in the output window of editors. It shows the stack of called function blocks and/or sub-programs, from the top level calling program up to the current stepping position. For a UDFB, the Call Stack also indicates which instance of the UDFB is executed.
At any moment you can double-click on a line of the Call Stack to open the corresponding program.
Debugging |
IEC 61131-3 Automation platform > IEC 61131-3 Programming Environment > Running the application > Debugging |
Created with the Personal Edition of HelpNDoc: Powerful and User-Friendly Help Authoring Tool for Markdown Documents