Programming instructions
6.2 Extended instructions
The following table shows the maximum possible string lengths required for each supported
data type.
IN data
type
USInt
SInt
UInt
Int
UDInt
DInt
Output String format rules:
● Values written to parameter OUT do not use a leading "+" sign.
● Fixed-point representation is used (no exponential notation).
● The period character "." is used to represent the decimal point when parameter IN is the
STRG_VAL instruction
Parameter P is also returned as an offset count in the original string at the position where the
conversion terminated. String data must be initialized before execution as a valid string in
memory.
Parameter
IN
FORMAT
P
OUT
138
Maximum number of converted
characters in OUT string
3
4
5
6
10
11
Real data type.
Parameter type
IN
IN
IN_OUT
OUT
Example
255
-128
65535
-32768
4294967295
-2147483648
STRG_VAL (String to Value) converts a number character string
to the corresponding integer or floating point representation.
Conversion begins in the string IN at character offset P and
continues until the end of the string, or until the first character is
encountered that is not "+", "-", ".", ",", "e", "E", or "0" to "9". The
result is placed at the location specified in parameter OUT.
Data type
String
Word
UInt
SInt, Int, DInt, USInt,
UInt, UDInt, Real
Total string length including
maximum and current length bytes
5
6
7
8
12
13
Description
The ASCII character string to convert
Output format options
IN: Index to the first character to be
converted (first character = 1)
OUT: Index to the next character after
conversion process ends
Converted number value
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02