101BExtended instructions
8.2 String and character
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
243
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
Real data type.
STRG_VAL instruction
Table 8- 24 String-to-value instruction
LAD / FBD
SCL
Description
"STRG_VAL"(
in:=_string_in,
format:=_word_in,
p:=uint_in,
out=>_variant_out);
Converts a number character string to the corresponding
integer or floating point representation.
1
For LAD / FBD: Click the "???" and select the data type from the drop-down list.
Table 8- 25 Data types for the STRG_VAL instruction
Parameter and type
Data type
Description
IN
IN
String
The ASCII character string to convert
FORMAT
IN
Word
Output format options
P
IN
UInt, Byte, USInt
IN: Index to the first character to be converted
(first character = 1)
OUT
OUT
SInt, Int, DInt, USInt, UInt, UDInt,
Real, LReal
Converted number value
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.
String data must be initialized before execution as a valid string in memory.
The FORMAT parameter for the STRG_VAL instruction is defined below. The unused bit
positions must be set to zero.