Basic instructions
8.7 Conversion operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
299
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
Not available
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
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
Table 8- 123 ENO status
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-
Instruction does nothing.
Table 8- 124 Error output codes for the VARIANT_TO_DB_ANY instruction
252C The Variant data type at IN parameter has the value 0. The CPU
The data block does not exist or is too short (first access).