Siemens SIMATIC S7 System Manual page 245

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Table 8- 29
Data types for the VAL_STRG instruction
Parameter and type
IN
IN
SIZE
IN
PREC
IN
FORMAT
IN
P
IN
OUT
OUT
The value represented by parameter IN is converted to a string referenced by parameter
OUT. The parameter OUT must be a valid string before the conversion is executed.
The converted string will replace characters in the OUT string starting at character offset
count P to the number of characters specified by parameter SIZE. The number of characters
in SIZE must fit within the OUT string length, counting from character position P. This
instruction is useful for embedding number characters into a text string. For example, you
can put the numbers "120" into the string "Pump pressure = 120 psi".
Parameter PREC specifies the precision or number of digits for the fractional part of the
string. If the parameter IN value is an integer, then PREC specifies the location of the
decimal point. For example, if the data value is 123 and PREC = 1, then the result is "12.3".
The maximum supported precision for the Real data type is 7 digits.
If parameter P is greater than the current size of the OUT string, then spaces are added, up
to position P, and the result is appended to the end of the string. The conversion ends if the
maximum OUT string length is reached.
The FORMAT parameter for the VAL_STRG instruction is defined below. The unused bit
positions must be set to zero.
Table 8- 30
Bit
16
0
s = Number sign character
f = Notation format
r = Decimal point format
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
Data type
SInt, Int, DInt, USInt, UInt,
UDInt, Real, LReal
USInt
USInt
Word
UInt, Byte, USInt
String
Format of the VAL_STRG instruction
0
0
0
0
Description
Value to convert
Number of characters to be written to the OUT string
The precision or size of the fractional portion. This does
not include the decimal point.
Output format options
IN: Index to the first OUT string character to be replaced
(first character = 1)
The converted string
Bit 8 Bit 7
0
0
0
0
1= use sign character "+" and "-"
0 = use sign character "-" only
1= Exponential notation
0 = Fixed point notation
1 = "," (comma character)
0 = "." (period character)
101BExtended instructions
8.2 String and character
0
0
0
0
Bit 0
s
f
r
245

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents