101BExtended instructions
8.2 String and character
Conversion of the string parameter IN starts at the first character and continues until the end
of the string, or until the first character is encountered that is not "0" through "9", "+", "-", or
".". The result value is provided at the location specified in parameter OUT. If the output
number value does not fit in the range of the OUT data type, then parameter OUT is set to 0
and ENO is set to FALSE. Otherwise, parameter OUT contains a valid result and ENO is set
to TRUE.
Input String format rules:
● If a decimal point is used in the IN string, you must use the "." character.
● Comma characters "," used as a thousands separator to the left of the decimal point are
● Leading spaces are ignored.
● Floating-point as well as fixed-point representation is supported. The characters "e" and
S_CONV (Value to string conversions)
Table 8- 22
Data types (value to string)
Parameter and type
IN
IN
OUT
OUT
An integer, unsigned integer, or floating point value IN is converted to the corresponding
character string at OUT. The parameter OUT must reference a valid string before the
conversion is executed. A valid string consists of a maximum string length in the first byte,
the current string length in the second byte, and the current string characters in the next
bytes. The converted string replaces characters in the OUT string starting at the first
character and adjusts the current length byte of the OUT string. The maximum length byte of
the OUT string is not changed.
How many characters are replaced depends on the parameter IN data type and number
value. The number of characters replaced must fit within the parameter OUT string length.
The maximum string length (first byte) of the OUT string should be greater than or equal to
the maximum expected number of converted characters. The following table shows the
maximum possible string lengths required for each supported data type.
Table 8- 23
Maximum string lengths for each data type
IN data type
Maximum number of converted
characters in OUT string
USInt
3
SInt
4
UInt
5
Int
6
UDInt
10
DInt
11
242
allowed and ignored.
"E" are recognized as exponential notation.
Data type
String, Char, SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
String
Example
Total string length including maximum and
current length bytes
255
5
-128
6
65535
7
-32768
8
4294967295
12
-2147483648
13
Description
Input number value
Output character string
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05