Omron CJ - INSTRUCTIONS Reference Manual page 1147

Table of Contents

Advertisement

Text string comparison instructions
The following table provides details of these instructions.
Function
True when S1 text string equals S2 text string.
True when S1 text string does not equal S2 text
string.
True when S1 text string is less than S2 text
string.
True when S1 text string is less than or equal to
S2 text string.
True when S1 text string is greater than S2 text
string.
True when S1 text string is greater than or equal
to S2 text string.
The comparison methods are as follows:
The first character (byte) of each text string is compared with its counterpart from the other string as
ASCII code. If the two ASCII codes are not equal, then that greater/lesser relationship becomes the
greater/lesser relationship for the two text strings.
If the two ASCII codes are equal, the next characters are compared. If these two ASCII codes are not
equal, then, that greater/lesser relationship becomes the greater/lesser relationship for the two text
strings. In this manner, the two text strings are compared in order, character by character. If all of the
characters, including the NUL, are equal, then the two text strings will have an equal relationship.
If the two text strings are of differing lengths, then the NUL (00 hex) will be added to the shorter of the
two strings to fill in the difference, and the comparison will be made on that basis.
Example: AD (414400 hex) and BC (424300 hex):
AD < BC, because at the beginning of the text strings 41 (hex) is less than 42 (hex).
Example: ADC (41444300 hex) and B (4200 hex):
ADC < B, because at the beginning of the text strings 41 (hex) is less than 42 (hex).
Example: ABC (41424300 hex) and ABD (41424400 hex):
ABC < ABD, because at the beginning of the text strings the 41s and 42s match, so the result
is determined by 43 being less than 44.
Example: ABC (41424300 hex) and AB (414200 hex):
ABC > AB, because at the beginning of the text strings the 41s and 42s match, so the result
is determined by 43 being greater than 00.
Example: AB (414200 hex) and AB (414200 hex):
AB = AB, because the 41s, the 42s, and the 00s all match.
Continue programming one instruction after another, treating LD, AND, and OR in the same way. LD
and OR instructions can be connected directly to the bus bar, but AND instructions cannot.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Mnemonic
LD=$(670)
LOAD STRING EQUALS
AND=$(670)
AND STRING EQUALS
OR=$(670)
OR STRING EQUALS
LD<>$(671)
LOAD STRING NOT EQUAL
AND<>$(671)
AND STRING NOT EQUAL
OR<>$(671)
OR STRING NOT EQUAL
LD<$(672)
LOAD STRING LESS THAN
AND<$(672)
AND STRING LESS THAN
OR<$(672)
OR STRING LESS THAN
LD<=$(673)
LOAD STRING LESS THAN OR EQUALS
AND<=$(673)
AND STRING LESS THAN OR EQUALS
OR<=$(673)
OR STRING LESS THAN OR EQUALS
LD>$(674)
LOAD STRING GREATER THAN
AND>$(674)
AND STRING GREATER THAN
OR>$(674)
OR STRING GREATER THAN
LD>=$(675)
LOAD STRING GREATER THAN OR EQUALS
AND>=$(675)
AND STRING GREATER THAN OR EQUALS
OR>=$(675)
OR STRING GREATER THAN OR EQUALS
3. Instructions
Name
Code
670
671
672
673
3
674
675
1109

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents