Comparison instructions
108
Part II IEC Instructions
EQ
Equal to
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types Availability of EQ (see page 1335)
Inputs can be of any data type; all input variables must be of the same
data type though. Output must be of type BOOL.
The number of input contacts lies in the range of 2 to 28.
The number of steps may vary depending on the PLC and parameters
used, see also Table of Code Intensive Instructions in the online help.
Data type I/O Function
all data types 1st input value for comparison
all data types 2nd input reference value
BOOL output result, TRUE if value for comparison is equal to the
reference value
The variables that are compared to each other must be of the same data type.
When using more inputs, the first input is compared with the second, the second input is compared
with the third input etc. If the first value is equal to the second value AND the second value is equal
to the third value etc., TRUE will be written into result, otherwise FALSE.
In this example the input variables (comparison_value, reference_value and enable) have been
declared. Instead, you may enter constants directly into the function (enable input e.g. for tests).
Description
The content of the accumulator is compared with the operand defined in the operand field. If both
values are equal, "TRUE" is stored in the accumulator, otherwise "FALSE".
Data types
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables which are required for programming the function are declared in the
POU header.
Body
If enable is set (TRUE), the variable comparison_value is compared with the variable
reference_value. If the values of the two variables are identical, the value TRUE will be written into
result, otherwise FALSE.
LD