Basic instructions
8.7 Conversion operations
S7-1200 Programmable controller
300 System Manual, V4.2, 09/2016, A5E02486680-AK
8132 The data block is too short and not an Array data block (second
The data block is write-protected
8150 The data type Variant at parameter IN provides the value "0". To
receive this error message, the "Handle errors within block" block
property must be activated. Otherwise the CPU changes to STOP
mode and sends the error code 16#252C
The data block has the incorrect data type.
*You can display error codes in the program editor as integer or hexadecimal values.
DB_ANY_TO_VARIANT (Convert DB_ANY to VARIANT)
You use the "DB_ANY to VARIANT" instruction to read the number of a data block that
meets the requirements listed below. The operand at the IN parameter has the data type
DB_ANY, which means you do not need to know during program creation which data block is
to be read. The instruction reads the data block number during runtime and writes it to the
function result RET_VAL by means of a VARIANT pointer.
Table 8- 125 DB_ANY_TO_VARIANT instruction
Not available
DB_ANY_TO_VARIANT(
in := _db_any_in_,
err => _int_out_);
Reads the data block number from the Variant IN parameter and
stores it in the function result, which is of the type Variant
Table 8- 126 Parameters for the DB_ANY_TO_VARIANT instruction
Variant that contains the data block number
RET_VAL Variant Output DB_ANY data type that contains the
converted data block number
Table 8- 127 ENO status
1 No error Instruction converts the data block number in
the variant and stores it in the function DB_ANY
output
0 Enable input EN has the signal state "0" or the IN
Instruction does nothing.