Chapter 4. Ladder Diagram (LD) Programming
GFK-2950C February 2018 213
4.12.2 Equal, Not Equal, Greater or Equal, Greater Than, Less or Equal,
Less Than
Other data types:
_INT
_REAL
_LREAL
_UINT
When the relational function receives power flow, it compares input IN1 to input IN2. These
operands must be the same data type. If inputs IN1 and IN2 are equal, the function passes power to
the right, unless IN1 and/or IN2 is NaN (Not a Number). The following relational functions can be
used to compare two numbers:
Note: If an Overflow occurs with a _UINT operation, the result wraps around – refer to the section
on Overflow.
If the _DINT or _INT operations are fed the largest possible value with any sign, they cannot
determine if it is an overflow value. The power flow output of the previous operation would
need to be checked. If an overflow occurred on a previous DINT, or INT operation, the result
was the largest possible value with the proper sign and no power flow.
Tip: To compare values of different data types, first use conversion functions to make the types
the same. The relational functions require data to be one of the following types: DINT, INT,
REAL, LREAL, or UINT.
Operands
The first value to be compared; the value on the left side of the
relational statement.
The second value to be compared; the value on the right side of
the relational statement. IN2 must be the same data type as
IN1.
The power flow. If the relational statement is true, Q is
energized, unless IN1 or IN2 is NaN.