Extended instructions
8.2 String and character
S7-1200 Programmable controller
296 System Manual, 03/2014, A5E02486680-AG
STRG_VAL (convert characer string to numerical value)
Table 8- 22 String-to-value instruction
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- 23 Data types for the STRG_VAL instruction
The ASCII character string to convert
P IN UInt, Byte, USInt IN: Index to the first character to be converted (first
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.
Table 8- 24 Format of the STRG_VAL instruction
onential notation
1 = "," (comma character)
0 = "." (period character)