4Control Monitoring And Debugging | |
To debug a runtime program in 4C Engineering, you can set breakpoints and execute single steps which allow you to stop the program execution in a targeted way at selected points. Together with the possibilities to monitor variable and expression values and to change variable values at runtime, these options enable you to analyze the program flow and the status of variables during the execution of particular statements. The debug modes define the positions in the source code where breakpoints can be set. Therefore, the possible breakpoint positions depend on the selected debug mode. The possible breakpoint positions defined in this way are also valid for a single-step execution of the source code. When you use single-step execution for debugging your source code, the position where the execution of a particular program step stops is always identical with the next possible breakpoint position. In Advanced Debugging, breakpoints can be set both at the beginning and the end of a POU and within the POU body. In the ST editor, breakpoints can be placed before any statement which is terminated by a semicolon. In the graphic editor, the possible breakpoint positions depend on the language elements. In the FBD editor, breakpoints can be set in POUs and variables. In the ST editor, breakpoints can be set in transitions and actions The debug options are only available on the toolbar and in the context menu if you opened the POU from the Instance view of the Navigator so that it is displayed in the ST editor or the graphic editor. In this case, the lower half of the editor window containing the opened POU not only shows the Class tab but also another tab with the name of the opened instance. For every instance of the same element you open in the Instance view another tab is added.
The Class tab is only used for editing the source code. This means that if you open a POU from the Class view, the source code is only displayed in the Class tab and no Instance tabs are displayed even if declared instances of this POU exist. To set breakpoints and execute single steps for a particular POU instance, you must enable its Instance tab. If an Instance tab has been enabled, the source code of the underlying class for this instance cannot be changed. To enable the Instance tab of a particular instance, simply click on it. | |
| The Breakpoint View | |
The BreakPoint view is a separate window in 4C Engineering. It is used for the central management of all breakpoints inserted into a project and facilitates the navigation to the positions in the source code where you have set breakpoints. The breakpoint and stop position display in the BreakPoint view is automatically updated if an action is performed in 4C Engineering which affects this information. Each time you add or delete a breakpoint in 4C Engineering, it is also added or deleted in the BreakPoint view. The same is true for enabling or disabling a breakpoint. The display of the current position in the program execution is automatically updated when you execute a single step or go to the next breakpoint. The BreakPoint view not only reflects debugging-related actions performed in 4C Engineering, but it can also be used to perform any debugging actions possible in 4C Engineering except for setting breakpoints and executing single steps. Moreover, from the BreakPoint view you can go directly to a particular breakpoint position on the Instance tab of the corresponding instance. This is particularly useful if breakpoints were inserted in instances of different base classes since the corresponding editor window is automatically opened or placed on top. | |
| The Watch View | |
In the Watch view, you can monitor variable values and the values of expressions of a runtime program downloaded to a runtime system and change the values of variables. This means that variable values can be written as well as read in the Watch view. Variable values changed in the Watch view influence the program execution of a project downloaded to a runtime system in the same way as if the values had been changed within the program. The number of values which can be displayed is not limited. The representation of expressions (POUs and variables) and of their values in the display area is determined by the hierarchical organization of POUs and variables defined in the IEC programming model (see also The Programming Model in 4CONTROL). You can display entire configurations in the Watch view. A configuration may contain resources, programs, instances of function blocks etc. If you expand the configuration after inserting it by clicking the plus sign, you can see the program elements contained in the configuration in a hierarchical tree structure. Program elements on a lower hierarchical level than the associated program elements are displayed further to the right. Each program element with its assigned values is displayed in a separate row. Some fields of the rows in which POU instances can be displayed are empty since instances of POUs may contain other instances of POUs or variables but, of course, they cannot contain values which might be represented as simple data types. Such values only exist on lower levels starting at the variable level. The same is true for arrays and structures. Here, the first level to include values which can be displayed is the element level. | |
| Data Tips and Watchpoints | |
Variable values can be monitored at the "normal" runtime of a runtime program and during a debugging process using data tips and watchpoints. The only difference between data tips and watchpoints lies in their display behavior. The displayed contents and the positioning possibilities of data tips and watchpoints are identical. The Watch view offers more comprehensive possibilities for monitoring variable values and calculated expressions at runtime and during the debugging process. Data tips display the value of the variable on which the cursor is currently placed. The data tip disappears as soon as you place the cursor at another position. Watch points, however, are set using a menu option or a special keystroke. They are permanently displayed. In the ST editor, data tips and watchpoints can be positioned both in the declaration section and in the body of an element. For variables which have been defined in other element instances, the variable name is preceded by the instance name, separated by a dot. Data tips and watchpoints can be positioned on variables declared in the declaration section and the graphical representation of variables in the element body. In addition, they can also be positioned on inputs and outputs within a function block instance. In this case, the variable name is preceded by the name of the function block instance, separated by a dot.
In SFC networks, data tips and watchpoints can also be positioned on steps, actions, action blocks, and transitions. | |
| Monitoring and Controlling SFC Networks | |
For debugging SFC networks you can basically use all options that are also available for debugging projects which do not contain SFC networks. Furthermore, 4CONTROL also offers a special SFC watch mode for SFC networks and options you can use to influence and control specific actions and transitions in the debug mode or during the normal runtime of the project. Independent of whether the normal runtime mode or the debug mode is active, the STEP keyword associated with the currently active step and the ACTION keyword associated with the currently executed action are highlighted in gray within the SFC networks in the Instance view of the ST editor. This shows you straight away which steps and which actions are currently being executed. At the same time, the graphical representation of the active step and the upper part of the graphical representation of a currently active action are highlighted in gray in the graphic editor. If the statements associated with an action were defined in an action block, the fields for the qualifier and for the name of the action block are highlighted in gray. | |






