Left, Right, And Mid (Read Substrings In A Character String) Instructions - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Extended instructions
8.2 String and character
Table 8- 54
ENO status
ENO
Condition
1
No errors detected
0
Resulting string after concatenation is larger than maximum length of OUT
string
Current length of IN1 exceeds maximum length of IN1, current length of
IN2 exceeds maximum length of IN2, or current length of OUT exceeds
maximum length of OUT (invalid string)
Maximum length of IN1, IN2 or OUT does not fit within allocated memory
range
Maximum length of IN1 or IN2 is 255, or the maximum length of OUT is 0
or 255
8.2.4.4

LEFT, RIGHT, and MID (Read substrings in a character string) instructions

Table 8- 55
Left, right and middle substring operations
LAD / FBD
SCL
out := LEFT(in, L);
out := MID(in, L, p);
out := RIGHT(in, L);
308
Description
LEFT (Left substring) provides a substring made of the first L
characters of string parameter IN.
If L is greater than the current length of the IN string, then the entire
IN string is returned in OUT.
If an empty string is the input, then an empty string is returned in
OUT.
MID (Middle substring) provides the middle part of a string. The middle
substring is L characters long and starts at character position P
(inclusive).
If the sum of L and P exceeds the current length of the string
parameter IN, then a substring is returned that starts at character
position P and continues to the end of the IN string.
RIGHT (Right substring) provides the last L characters of a string.
If L is greater than the current length of the IN string, then the entire
IN string is returned in parameter OUT.
If an empty string is the input, then an empty string is returned in
OUT.
OUT
Valid characters
Resulting string characters are
copied until the maximum length
of the OUT is reached
Current length is set to 0
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents