Description
Original instructions
Function description
The COMP_DB function block enables two numerical values IN1 and IN2 to be compared.
Depending whether IN1 is greater than, equal to or less than IN2, the function blocks sets one of the outputs GREATER, EQUAL or LESS to 1.
The function block takes any dead zone or hysteresis into account.
EN and ENO can be configured as additional parameters.
COMP_DB/COMP_DB_DFB
Creating new programs, always use the COMP_DB function block.
For technical reasons the COMP_DB_DFB may be implemented during converting legacy programs. But the functionality of COMP_DB and COMP_DB_DFB is exactly the same.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL COMP_DB (IN1=:InputValue1, IN2:=InputValue2,
        DBAND=:DeadBand, HYST:=Hysteresis,
        GREATER=>GreaterValueIndicator,
        EQUAL=>EqualValueIndicator, LESS=>LessValueIndicator)
Representation in ST
Representation:
COMP_DB (IN1=:InputValue1, IN2:=InputValue2,
        DBAND=:DeadBand, HYST:=Hysteresis,
        GREATER=>GreaterValueIndicator,
        EQUAL=>EqualValueIndicator,
        LESS=>LessValueIndicator);
Parameter description
Description of input parameters:
Parameter
Data type
Description
IN1
Input No. 1
IN2
REAL
Input No. 2
DBAND
REAL
Dead zone
HYST
REAL
Hysteresis
Description of output parameters:
Parameter
Data type
Description
GREATER
Greater-than marker
EQUAL
BOOL
Equals marker
LESS
BOOL
Less-than marker
Runtime error
An error is displayed in the Diagnostics display (View → Diagnostics View) if a non floating point value is determined at an input, or if a problem occurs when calculating a floating point value. In this case the GREATER, EQUAL and LESS outputs remain unchanged.
NOTE: For a list of all block error codes and values, see Mathematics.
Warning
A warning is displayed in the Diagnostics display (View → Diagnostics Display) if,