VariantGet: Read out VARIANT tag value (S7-1200, S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
VariantGet: Read out VARIANT tag value

Description

You can use the "Read out VARIANT tag value" instruction to read the value of the tag to which the VARIANT at the SRC parameter points and write it in the tag at the DST parameter.

The SRC parameter has the VARIANT data type. Any data type except for VARIANT can be specified at the DST parameter.

The data type of the tag specified at the DST parameter must match the data type to which the VARIANT points.

Note

To copy structures and ARRAYs, you can use the "MOVE_BLK_VARIANT instruction: Move block" instruction. For additional information, refer to "See also".

Enable output ENO has the signal state "0" if one of the following conditions applies:

  • Enable input EN has the signal state "0".

  • The data types do not correspond. (No value is transferred.)

Parameters

The following table shows the parameters of the "Read out VARIANT tag value" instruction:

Parameters

Declaration

Data type

Memory area

Description

S7-1200

S7-1500

EN

Input

BOOL

I, Q, M, D, L or constant

I, Q, M, D, L or constant

Enable input

ENO

Output

BOOL

I, Q, M, D, L

I, Q, M, D, L

Enable output

SRC

Input

VARIANT

L (The declaration is possible in the "Input", "InOut" and "Temp" sections of the block interface.)

Tag to be read

DST

Output

Bit strings, integers, floating-point numbers, timers, date and time, character strings, ARRAY elements, PLC data types

I, Q, M, D, L

I, Q, M, D, L, P

Result of the instruction

For additional information on valid data types, refer to "See also".

Example

The following example shows how the instruction works:

If the "TagIn" operand has signal state "1", the instruction is executed. The value of the tag to which the VARIANT at the "#TagIn_Source" operand points, is read and written to the "TagOut_Dest" operand.