Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)
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.
Operator
=
<
<=
>
>=
<>
· 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.
L
e
s
s
e
r
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Description
Equal
Less than
Less than or equal
Greater than
Greater than or equal
Not equal
ASCII Characters
1ab
1b
G
r
A
e
a
t
AB
e
r
B
a
ab
Chapter 5
Hex Codes
$31$61$62
$31$62
$41
$41$42
AB < B
$42
a > B
$61
$61$62
225