Navigation:  Equipments (Devices) > SCA06 > Ladder > Compare >

COMPNE

Previous pageReturn to chapter overviewNext page

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

 

Ladder Representation

 

COMPNE_block

 

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

 

COMPNE_flowchart

 

Example in Ladder

 

COMPNE_example01

 

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

 

COMPNE_example02

 

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);