Extended instructions
8.2 String and character
RET_VAL
Description
(W#16#....)
8101
Illegal or invalid input pointer, for example, an access to a DB that does not exist.
8120
Input string is an invalid format, i.e., max= 0, max=255, current>max, or grant length in
pointer < max
8182
Input buffer is too small for N
8151
Data type not allowed for input buffer
8301
Illegal or invalid output pointer, for example, an access to a DB that does not exist.
8320
Output string is an invalid format, i.e., max= 0, max=255, current>max, or grant length
in pointer < max
8382
Output buffer is too small for N
8351
Data type not allowed for output buffer
8.2.4
String operation instructions
Your control program can use the following string and character instructions to create
messages for operator display and process logs.
8.2.4.1
MAX_LEN (Maximum length of a character string) instruction
Table 8- 47
Maximum length instruction
LAD / FBD
SCL
out :=
MAX_LEN(in);
Table 8- 48
Data types for the parameters
Parameter and type
IN
IN
OUT
OUT
306
Description
MAX_LEN (Maximum length of string) provides the maximum length value
assigned to string IN at output OUT. If errors occur during processing of the
instruction, then an empty string length will be output.
The STRING data type contains two lengths: the first byte gives the maximum
length and the second byte gives the current length (this is the current number
of valid characters).
The maximum length of the character string is assigned for each STRING
•
definition in square brackets. The number of bytes occupied by a string is 2
bytes greater than the maximum length.
The current length represents the number of the character places actually
•
used. The current length must be less than or equal to the maximum
length.
Use the MAX_LEN instruction to get the maximum length of the character
string and the LEN instruction to get the current length of a string.
Data type
String
DInt
Description
Input string
Maximum number of characters allowed for IN
string
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
ENO
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
Need help?
Do you have a question about the S7-1200 and is the answer not in the manual?
Questions and answers