Chapter 10 Compare instructions
260 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015
Equal (=) compares the first input to the second input to determine equality for
Integer, Real, Time, Date, and String data types.
Recommendation: Using the Equal (=) operator
Equality testing of Time values is not recommended for TON, TP, and TOF
functions.
The Real data type is not recommended when comparing values for equality
because numbers in the math operation are rounded differently than those that
appear in the variable output display. Consequently, two output values may appear
equal in the display, but will still evaluate as false. For example, 23.500001
compared to 23.499999 will both display as 23.5 in the variable input display, but
will not be equal in the controller. For an alternative method to determine
equality, see the following topic.
Arguments
Parameter Parameter Type Data Type Description
EN Input BOOL Function enable.
When Enable = TRUE, execute the equality comparison.
When Enable = FALSE, there is no comparison.
Applies only to LD programs.
i1 Input BOOL - SINT - USINT - BYTE - INT -
UINT - WORD - DINT - UDINT - DWORD
- LINT - ULINT - LWORD - REAL - LREAL
- TIME - DATE - STRING
All inputs must be the same data type.
The Time input applies to the ST, LD and FBD languages.
Note: The Real data type is not recommended.
i2 Input BOOL - SINT - USINT - BYTE - INT -
UINT - WORD - DINT - UDINT - DWORD
- LINT - ULINT - LWORD - REAL - LREAL
- TIME - DATE - STRING
o1 Output BOOL
TRUE if i1 = i2.