Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 225
Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ) Chapter 5
Use Strings in an Expression
Use a relay ladder or structured text expression to compare string data types. To
use strings in an expression, follow these guidelines:
· An expression lets you compare two string tags.
· You cannot enter ASCII characters directly into the expression.
· Only the following operators are permitted.
· Strings are equal if their characters match.
· ASCII characters are case sensitive. Upper case ‘A’ ($41) is not equal to
lower case ‘a’ ($61).
· The hexadecimal values of the characters determine if one string is less than
or greater than another string. For the hex code of a character, see the back
cover of this manual.
· When the two strings are sorted as in a telephone directory, the order of
the strings determines which one is greater.
Operator Description
= Equal
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal
<> Not equal
ASCII Characters Hex Codes
1ab $31$61$62
1b $31$62
A $41
AB $41$42
B $42
a $61
ab $61$62