Compare Character Strings - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Program instructions
7.4 Compare
7.4.2

Compare character strings

The compare string instructions can compare two ASCII character strings.
For LAD and FBD: When the comparison is TRUE, the compare instruction turns ON the
contact (LAD), or output (FBD).
For STL: When the comparison is TRUE, the compare instruction loads, ANDs, or ORs a 1
with the value on the top of the logic stack.
Comparisons can be made between two variables, or between a constant and a variable. If a
constant is used in a comparison, then it must be the top parameter (LAD contact / FBD box)
or the first parameter (STL).
In the program editor, a constant string parameter assignment must begin and end with a
double quote character. The maximum length of a constant string entry is 126 characters
(bytes).
In contrast, a variable string is referenced by the byte address of the initial length byte with
the character bytes stored the next byte addresses. A variable string has a maximum length
of 254 characters (bytes) and can be initialized in the data block editor (with beginning and
ending double quote character).
LAD contact
FBD box
234
STL
LDS=
IN1, IN2
OS=
IN1, IN2
AS=
IN1, IN2
LDS<>
IN1, IN2
OS<>
IN1, IN2
AS<>
IN1, IN2
Description
Compare two character strings of STRING data type:
The result is TRUE, if string IN1 equals string IN2.
Compare two character strings of STRING data type:
The result is TRUE, if string IN1 does not equal string IN2.
System Manual, V2.3, 07/2017, A5E03822230-AF
S7-200 SMART

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents