Introduction:
Within this post, we demonstrate how to use the macro debugging tools available within cMT Diagnoser. This application is only available when using cMT or cMT-X HMIs.
Software Version:
EasyBuilder Pro 6.04.01.250+
Instructions:
-
To debug a macro click on “Off-line Simulation” or “On-line Simulation” within the Macro workspace. While the simulation is running, the cMT Diagnoser will open as well:
-
Within the Diagnoser navigate to the “Macro” tab.
-
Within the “Macro” tab you will see two additional tabs labeled “Execute” and “Debug”. The “Execute" tab will allow you to run a macro, whereas the “Debug” tab will allow you to monitor execution status or make revisions:
-
Within the “Debug” tab click on the “Start debugging” button before or during macro execution to start the debugging process:
-
To insert a breakpoint, click the black bar along the left of the corresponding line. When selected a red dot will appear on the selected line. The debugger will stop the program on these lines allowing you to analyze your program:
Note: In the example below breakpoints have been added to lines 6 and 7.
-
The “Watch” section displays a live view of variables added to this list. To insert a variable into the “Watch” section, hover your mouse below the “Name” column and an orange highlight should pop up. Clicking on this popup will display most of the variables within this macro and allow you to search for any that aren’t displayed in this drop-down list. In the example below the “done” variable has been added and the value of “done” will be displayed as the program executes. You can add multiple variables to the “Watch” section when the program is running:
Note: The orange highlight is displayed when hovering your mouse below the “Name” column.
-
Inside the “Debugger”, you can seamlessly transition between macros by clicking on the drop-down menu near the top next to the “Start Debugging” button. This will allow you to debug any other macros you have available:
-
Within the example below the “Step Into”, “Step Out” and “Step Over” actions are defined:
[a]. “Step Into” allows you to enter and debug a user-defined function.
[b]. “Step Out” allows you to return to the function call and is the inverse of “Step Into”.
[c]. “Step Over” allows you to proceed to the next statement or function call without debugging a user-defined function.
Note:
Modifications made within cMT Diagnoser can be saved when closing the simulation. To do this, users are required to initiate the “Offline Simulation” exclusively through the designated “Macro”. If the simulation is initiated through alternative means, such as by clicking the “Offline Simulation” button within the “Project” tab, the user will not be able to alter code within the Macro during runtime. Moreover, after making any modifications within the Diagnoser it is important to execute a “Save & Compile” action.