The objective of this tutorial is to explain how to use the comparison block with the equality function in 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
The EQ operator is used to perform equality comparisons between two values. It is widely used in decision logic, allowing an action to be executed only when two values are exactly equal.
This operator returns a logical value (BOOL), which can be used to enable contacts, blocks, or coils within Ladder logic.
EQ Operator Concept
The EQ operator compares two operands:
- Returns TRUE → when the two compared values are equal
- Returns FALSE → when the values are different
The comparison can be made between:
- Variable × constant
- Variable × variable
- Constant × constant
As long as the data types are compatible.
Using EQ in Ladder Logic
The result of the EQ operator is a logical value (TRUE or FALSE), which is normally used:
- In series with other blocks
- To enable coils
- To allow the execution of operations
- To validate specific process conditions
The logic will only be executed when the equality condition is met.
Adding the EQ operator to the logic
To add the EQ operator:
- Open the Toolbox.
- Access Mathematical Operators.
- Select the EQ operator.
- Click and drag the block to the Ladder logic.
After insertion, the operator will be available to receive the two values that will be compared.
Figure 2. Insertion of the EQ mathematical operator
Conceptual application example
- Compare a process value with a reference value
- Trigger an output only when:
- A counter reaches a specific value
- A variable is exactly at the expected value
- An internal system state is reached
In this scenario:
- If the values are equal → EQ = TRUE → logic enabled
- If they are different → EQ = FALSE → logic blocked
Precautions with data types
When using the EQ operator, it is important to observe:
- The data types must be compatible (e.g., INT with INT, REAL with REAL)
- Comparisons between REAL values may require attention due to decimal places
- Avoid comparing values of very different types without proper conversion
These precautions prevent unexpected results in the logic.
Figure 3. Parameterization of the EQ mathematical operator
Series connection as a logic control
Like other comparison operators, EQ is usually connected in series with the rest of the logic:
• EQ acts as a logic filter
• Only when the condition is true does the logic flow continue
• This makes the program more organized, predictable, and safe
Practical application
After inserting and parameterizing the EQ operator:
- Download the application.
- Put the CPU in RUN mode.
- Change the compared values:
- Equal values → true condition
- Different values → false condition
- Observe the behavior of the logic associated with the EQ result.
The EQ operator is essential for decisions based on equality, being widely used in state comparisons, process validations, and precise logic control within industrial applications.
Figure 4. EQ mathematical operator conditioning the logic as a filter
Comments
0 comments
Please sign in to leave a comment.