COMPARE: Comparing two integers
Original instructions
Function description
The function COMPARE performs a comparison between two integers.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Valid
COMPARE Value1, Value2, Greater_Than, Equal_Values, Less_Than, Different_Values
Representation in ST
Representation:
COMPARE(Valid, Value1, Value2, Greater_Than, Equal_Values, Less_Than, Different_Values);
Description of the parameters
The following table describes the input parameters:
Parameter
Type
Comment
Enable
Validation input. The comparison only takes place if this input is 1.
Value1
First value to compare.
Value2
Second value to compare.
The following table describes the output parameters:
Parameter
Type
Comment
Greater_Than
If Value1 > Value2 then
Greater_Than = 1
Otherwise
Greater_Than = 0
Equal_Values
If Value1 = Value2 then
Equal_Values = 1
Otherwise
Equal_Values = 0
Less_Than
If Value1 < Value2 then
Less_Than = 1
Otherwise
Less_Than = 0
Different_Values
If Value1Value2 then
Different_Values = 1
Otherwise
Different_Values = 0