Basic instructions
8.4 Comparator operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
253
Variant and array comparison instructions
8.4.4.1
Equality and non-equality comparison instructions
The S7-1200 CPU provides instructions for querying the data type of a tag to which a Variant
operand points for either equality or non-equality to the data type of the other operand.
In addition, the S7-1200 CPU provides instructions for querying the data type of an array
element for either equality or non-equality to the data type of the other operand.
In these instructions, you are comparing <Operand1> to <Operand2>. <Operand1> must
have the Variant data type. <Operand2> can be an elementary data type of a PLC data type.
In LAD and FBD, <Operand1> is the operand above the instruction. In LAD, <Operand2> is
the operand below the instruction.
For all instructions, the result of logic operation (RLO) is 1 (true) if the equality or non-
equality test passes, and is 0 (false) if not.
The equality and non-equality type comparison instructions are as follows:
● EQ_Type (Compare data type for EQUAL with the data type of a tag)
● NE_Type (Compare data type for UNEQUAL with the data type of a tag)
● EQ_ElemType (Compare data type of an ARRAY element for EQUAL with the data type
of a tag)
● NE_ElemType (Compare data type of an ARRAY element for UNEQUAL with the data
type of a tag)
Table 8- 36 EQ and NE instructions
Not avail-
able
Tests whether the tag pointed to by the Variant
at Operand1 is of the same data type as the
tag at Operand2.
Not avail-
able
Tests whether the tag pointed to by the Variant
at Operand1 is of a different data type as the
tag at Operand2.
Not avail-
able
Tests whether the array element pointed to by
the Variant at Operand1 is of the same data
type as the tag at Operand2.
Not avail-
able
Tests whether the array element pointed to by
the Variant at Operand1 is of a different data
type as the tag at Operand2.