Extended instructions
8.2 String and character
S7-1200 Programmable controller
306 System Manual, 03/2014, A5E02486680-AG
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
FALSE
Input buffer is too small for N
Data type not allowed for input buffer
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
FALSE
Output buffer is too small for N
Data type not allowed for output buffer
String operation instructions
Your control program can use the following string and character instructions to create
messages for operator display and process logs.
MAX_LEN (Maximum length of a character string) instruction
Table 8- 47 Maximum length instruction
MAX_LEN(in);
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.
Table 8- 48 Data types for the parameters
OUT OUT DInt Maximum number of characters allowed for IN