The objective of this tutorial is to explain how a programmer can comment a line of code within a MasterTool X project.
Components
Equipment: 1 computer/notebook.
Software: MasterTool X
Tutorial Sections
- ARCHITECTURE
- DEVELOPMENT
1. ARCHITECTURE
A computer/notebook will be required to use MasterTool X.
Figure 1. Computer running MasterTool X
2. DEVELOPMENT
During ladder logic development, it is common to need to temporarily disable a network for testing, validation, or maintenance without having to delete the code.
In MasterTool X, this is done through network comments.
What is commenting out a network?
Commenting out a network means:
- The logic is not executed by the PLC
- The code remains visible in the program
- It can be reactivated at any time
- It does not interfere with other networks
It is a safe and recommended practice for testing and debugging.
How to comment out a network (line)
To comment out a network:
- Select the network (line) you want to comment out.
- Right-click on the network.
- Select the option “Toggle network comment state”.
Figure 2. Menu to enable changing the state of the code line
Visual identification of the commented-out network
When a network is commented out:
- It does not participate in the execution of the logic
- The network is displayed in a greenish color
- It facilitates the visual identification of deactivated sections
This helps the programmer to quickly know which parts of the code are out of operation.
Figure 3. Commented code line
How to reactivate the commented network
If it is necessary to reactivate the logic:
- Select the commented network again.
- Right-click.
- Choose “Toggle network comment state” again.
The network will become active again and will run normally.
Figure 4. Revert the view of the code line
Advantages of commenting networks
- Avoids deleting already tested logic
- Facilitates comparative testing
- Allows safe debugging
- Maintains code history and understanding
Commenting networks is preferable to deleting code, especially in larger projects.
Conclusion
The network comment feature in MasterTool X is a simple and powerful tool for testing, maintenance, and debugging, allowing you to activate and deactivate parts of the logic quickly, safely, and reversibly.
Comments
0 comments
Please sign in to leave a comment.