101BExtended instructions
8.2 String and character
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
241
Table 8- 19 Data types for the parameters
Parameter
Data type
Description
IN
String
Source string
OUT
String
Target address
If the actual length of the string at the input IN exceeds the maximum length of a string
stored at output OUT, then the part of the IN string which can fit in the OUT string is copied.
8.2.3
String conversion instructions
8.2.3.1
String to value and value to string conversions
You can convert number character strings to number values or number values to number
character strings with these instructions:
●
S_CONV converts (number string to a number value) or (number value to a number
string)
●
STRG_VAL converts a number string to a number value with format options
●
VAL_STRG converts a number value to a number string with format options
S_CONV (String to value conversions)
Table 8- 20 String conversion instruction
LAD / FBD
SCL
Description
out :=
<Type>_TO_<Type>(in);
Converts a character string to the corresponding value, or a value
to the corresponding character string. The S_CONV instruction
has no output formatting options. This makes the S_CONV
instruction simpler, but less flexible than the STRG_VAL and
VAL_STRG instructions.
1
For LAD / FBD: Click the "???" and select the data type from the drop-down list.
2
For SCL: Select S_CONV from the Extended Instructions, and answer the prompts for the data types for the conversion.
STEP 7 then provides the appropriate conversion instruction.
Table 8- 21 Data types (string to value)
Parameter and type
Data type
Description
IN
IN
String
Input character string
OUT
OUT
String, Char, SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Output number value