This tutorial will show how to use the execute operator in a project in MasterTool X.
Components
Equipment: 1 computer/laptop.
Software: MasterTool X
Tutorial Sections
- ARCHITECTURE
- DEVELOPMENT
1. ARCHITECTURE
A computer/laptop will be required to use MasterTool X.
Figure 1. Computer running MasterTool X
2. DEVELOPMENT
The EXECUTE operator is used when you want to insert Structured Text (ST) logic directly inside a Ladder network, being very useful to implement calculations or more complex conditions without leaving the graphical language.
Concept
The EXECUTE operator works as a “code box,” where the programmer can write ST instructions that will be executed within the Ladder logic.
This allows:
- Greater flexibility
- Reduction of blocks in the logic
- Implementation of more elaborate conditions
Inserting the operator
To add the EXECUTE operator:
- Open the Toolbox
- Go to the General tab
- Select the EXECUTE operator
- Click and drag it into the Ladder network
Figure 2. Inserting the Execute operator in Ladder network
Variable declaration
Create the variable used in the example:
ivar : INT;
led_01 : BOOL;
Logic implementation
Inside the EXECUTE block, the logic in Structured Text will be inserted:
IF ivar >= 100 THEN
led_01 := TRUE;
ELSE
led_01 := FALSE;
END_IF;
Operation
- If the value of ivar is greater than or equal to 100:
- The variable led_01 = TRUE
- Otherwise:
led_01 = FALSE
Figure 3. Configuration of the execute operator
Applications in automation
The EXECUTE operator is widely used in:
- More complex conditional logics
- Mathematical calculations
- Data processing
- Reduction of blocks in Ladder
- Integration between Ladder and ST
Important notes
- The syntax inside EXECUTE must follow the rules of Structured Text
- You can use IF, mathematical operators, assignments, etc.
- It facilitates writing more advanced logic
- Organization should be maintained to avoid making reading difficult
Figure 4. Operation of the execute operator
Comments
0 comments
Please sign in to leave a comment.