Block that compares the values of Value1 and Value2, enabling the Q output if Value1 is different from Value2.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
Value1 |
BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL |
First value of comparison |
|
Value2 |
BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL |
Second value of comparison |
|
VAR_OUTPUT |
Q |
BOOL |
Indicator of inequality |
Operation
When this block has a TRUE value in EN, it sends to the Q output the TRUE value if Value1 is different from Value2. Otherwise, Q receives FALSE.
When EN has FALSE value, Q remains in FALSE.
Block Flowchart

Example in Ladder

The example above checks inequality between VALUE1 and VALUE2. Since both variables have different values, the Q output is activated.

The example above checks equality between VALUE1 and VALUE2. Since both variables have the same value, the Q output is disabled.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR VALUE1 : SINT := -23; VALUE2 : SINT := -23; END_VAR
DO1 := FB_COMP_NE(EN:=DI1, Value1:=VALUE1, Value2:=VALUE2);
|
|---|