EasyManua.ls Logo

Siemens S7-1200 - String Operation Instructions; MAX_LEN (Maximum Length of a Character String) Instruction

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Extended instructions
8.2 String and character
S7-1200 Programmable controller
306 System Manual, 03/2014, A5E02486680-AG
RET_VAL
(W#16#....)
Description
ENO
8101
Illegal or invalid input pointer, for example, an access to a DB that does not exist.
FALSE
8120 Input string is an invalid format, i.e., max= 0, max=255
, current>max, or grant length in
pointer < max
FALSE
8182
Input buffer is too small for N
FALSE
8151
Data type not allowed for input buffer
FALSE
8301
Illegal or invalid output pointer, for example, an access to a DB that does not exist.
FALSE
8320 Output string is an invalid format, i.e., max= 0, max=255, current>max, or grant length
in pointer < max
FALSE
8382
Output buffer is too small for N
FALSE
8351
Data type not allowed for output buffer
FALSE
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
Description
out :=
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
Parameter and type
Data type
Description
IN
IN
String
Input string
OUT OUT DInt Maximum number of characters allowed for IN
string

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals