Comparison instructions
111
Part II IEC Instructions
NE
Not equal
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 NE (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 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 unequal to
the reference value, otherwise FALSE
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 not equal to the second value AND the second value is
not 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 not 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 comparison_value is compared with the reference_value. If the two
values are unequal, TRUE will be written into result, otherwise FALSE.
LD