Section-3:Compare Instructions
Use this instruction:
- EQU
- GEQ
- GRT
- LEQ
- LES
- LIM
- MEQ
- NEQ
If you want to
- test whether two values are equal
- test whether one value is greater than or equal to a second value
- test whether one value is greater than a second value
- test whether one value is less than or equal to a second value
- test whether one value is less than a second value
- test whether one value is between two other values
- pass two values through a mask and test whether they are equal
- test whether one value is not equal to a second value
Compare values of different data types, such as floating point and integer.
The bold data types indicate optimal data types. An instruction executes at its fastest and with it lowest memory requirements if all the parameters of the instruction use the same optimal data type, typically DINT or REAL.
Equal To (EQU)
When enabled, the EQU instruction and the operator = test whether Source A is equal to Source B.
EQU Flow Chart (True)
Greater Than or Equal To (GEQ)
When enabled, the GEQ instruction and the operator >= test whether Source A is greater than or equal to Source B.
GEQ Flow Chart (True)
Greater Than (GRT)
When enabled, the GRT instruction and the operator > tests whether Source A is greater than Source B.
GRT Flow Chart (True)
Less Than or Equal To (LEQ)
When enabled, the LEQ instruction and the operator <= tests whether Source A is less than or equal to Source B.
LEQ Flow Chart (True)
Less Than (LES)
When enabled, the LES instruction and the operator < tests Source A is less than Source B.
LES Flow Chart (True)
Limit (LIM)
The LIM instruction tests if the Test value is within the range of the Low and High Limits as indicated in the LIM Flow Chart (True).
If any operand is Not A Number (NAN), the .EnableOut is cleared to false.
LIM Flow Chart (True)
Example: Low Limit <= High Limit
When Test value is equal to or greater than Low Limit, and Test value is less than or equal to High Limit, light_1 is set.
Mask Equal To (MEQ)
The MEQ instruction passes the Source and Compare values through a Mask and compares the results.
MEQ Flow Chart (True)
Not Equal To (NEQ)
When enabled, the NEQ instruction and the <> operator tests whether Source A is not equal to Source B.