EasyManua.ls Logo

Siemens SIMATIC S7-1200 - 8.7.6 Variant conversion instructions; 8.7.6.1 VARIANT_TO_DB_ANY (Convert VARIANT to DB_ANY)

Siemens SIMATIC S7-1200
1614 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...
Basic instructions
8.7 Conversion operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
299
8.7.6
Variant conversion instructions
8.7.6.1
VARIANT_TO_DB_ANY (Convert VARIANT to DB_ANY)
You use the "VARIANT to DB_ANY" instruction to read the operand at the IN parameter and
convert it to the data type DB_ANY. The IN parameter is of the Variant data type and
represents either an instance data block or an ARRAY data block. When you create the
program, you do not need to know which data block corresponds to the IN parameter. The
instruction reads the data block number during runtime and writes it to the operand at the
RET_VAL parameter.
Table 8- 121 VARIANT_TO_DB_ANY instruction
LAD / FBD
SCL
Description
Not available
RET_VAL :=
VARIANT_TO_DB_ANY(
in := _variant_in_,
err => _int_out_);
Reads the operand from the Variant IN parameter and stores it
in the function result, which is of the type DB_ANY
Table 8- 122 Parameters for the VARIANT_TO_DB_ANY instruction
Parameter
Data type
Description
IN Variant Variant that represents and instance data
block or an array data block
RET_VAL DB_ANY Output DB_ANY data type that contains the
converted data block number
ERR
Int
Error information
Table 8- 123 ENO status
ENO
Condition
Result
1 No error Instruction converts the input Variant and
stores it in the DB_ANY function output
0 Enable input EN has the signal state "0" or the IN param-
eter is invalid.
Instruction does nothing.
Table 8- 124 Error output codes for the VARIANT_TO_DB_ANY instruction
Err
(W#16#...)
Description
0000
No error
252C The Variant data type at IN parameter has the value 0. The CPU
changes to STOP mode.
8131
The data block does not exist or is too short (first access).

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals