EasyManua.ls Logo

Siemens S7-1200 - Strg_To_Chars and Chars_To_Strg; CHAR) Instructions

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
302 System Manual, 03/2014, A5E02486680-AG
Table 8- 34 Examples of VAL_STRG conversion
Data type
IN value
P
SIZE
FORMAT
(W#16#....)
PREC
OUT string
ENO
UInt 123 16 10 0000 0
Current Temp =
xxxxxxx123 C
TRUE
UInt 0 16 10 0000 2
Current Temp =
xxxxxx0.00 C
TRUE
UDInt 12345678 16 10 0000 3
Current Temp =
x12345.678 C
TRUE
UDInt 12345678 16 10 0001 3
Current Temp =
x12345,678 C
TRUE
Int 123 16 10 0004 0
Current Temp =
xxxxxx+123 C
TRUE
Int -123 16 10 0004 0
Current Temp =
xxxxxx-123 C
TRUE
Real -0.00123 16 10 0004 4
Current Temp = xxx-
0.0012 C
TRUE
Real -0.00123 16 10 0006 4
Current Temp = -
1.2300E-3 C
TRUE
Real -INF 16 10 N/A 4
Current Temp =
xxxxxx-INF C
FALSE
Real +INF 16 10 N/A 4
Current Temp =
xxxxxx+INF C
FALSE
Real NaN 16 10 N/A 4
Current Temp =
xxxxxxxNaN C
FALSE
UDInt 12345678 16 6 N/A 3
Current Temp =
xxxxxxxxxx C
FALSE
8.2.3.2
Strg_TO_Chars and Chars_TO_Strg (Convert to/from character string and array of
CHAR) instructions
Strg_TO_Chars copies an ASCII character string into an array of character bytes.
Chars_TO_Strg copies an array of ASCII character bytes into a character string.
Note
Only the zero based array types (Array [0..n] of Char) or (Array [0..n] of Byte) are allowed as
the input parameter Chars for the Chars_TO_Strg instruction, or as the IN_OUT parameter
Chars for the Strg_TO_Chars instruction.
Table 8- 35 Strg_TO_Chars instruction
LAD / FBD
SCL
Description
Strg_TO_Chars(
Strg:=_string_in_,
pChars:=_dint_in_,
Cnt=>_uint_out_,
Chars:=_variant_inout_);
The complete input string Strg is copied to an array of
characters at IN_OUT parameter Chars.
The operation overwrites bytes starting at array element
number specified by the pChars parameter.
Strings of all supported max lengths (1..254) may be used.
An end delimiter is not written; this is your responsibility.
To set an end delimiter just after the last written array
character, use the next array element number
[pChars+Cnt].

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals