Extended instructions
8.2 String and character
STRG_VAL (convert characer string to numerical value)
Table 8- 22
String-to-value instruction
LAD / FBD
For LAD / FBD: Click the "???" and select the data type from the drop-down list.
1
Table 8- 23
Data types for the STRG_VAL instruction
Parameter and type
IN
IN
FORMAT
IN
P
IN
OUT
OUT
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.
Table 8- 24
Bit
16
0
f = Notation format
r = Decimal point format
296
SCL
"STRG_VAL"(
in:=_string_in,
format:=_word_in,
p:=uint_in,
out=>_variant_out);
Data type
String
Word
UInt, Byte, USInt
SInt, Int, DInt, USInt, UInt, UDInt,
Real, LReal
Format of the STRG_VAL instruction
0
0
0
0
Description
Converts a number character string to the corresponding
integer or floating point representation.
Description
The ASCII character string to convert
Output format options
IN: Index to the first character to be converted (first
character = 1)
Converted number value
Bit 8 Bit 7
0
0
0
0
1= Exponential notation
0 = Fixed point notation
1 = "," (comma character)
0 = "." (period character)
0
0
0
0
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
Bit 0
0
f
r