EasyManua.ls Logo

Siemens S7-1200 - Page 298

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Extended instructions
8.2 String and character
S7-1200 Programmable controller
298 System Manual, 03/2014, A5E02486680-AG
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- 28 Format of the VAL_STRG instruction
Bit
16
Bit 8
Bit 7
Bit 0
0
0
0
0
0
0
0
0
0
0
0
0
0
s
f
r
s = Number sign character
1= use sign character "+" and "
-"
0 = use sign character "-" only
f = Notation format
1= Exponential notati
on
0 = Fixed point notation
r = Decimal point format
1 = "," (comma character)
0 = "." (period character)
Table 8- 29 Values of the FORMAT parameter
FORMAT (WORD)
Number sign character
Notation format
Decimal point representation
W#16#0000
"-" only Fixed point
"."
W#16#0001
","
W#16#0002 Exponential "."
W#16#0003
","
W#16#0004
"+" and "-" Fixed Point
"."
W#16#0005
","
W#16#0006
Exponential
"."
W#16#0007
","
W#16#0008 to W#16#FFFF Illegal values

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals