Skip to main content

Compare Instructions

Compare two numeric values and pass power along the rung if the relationship holds. Compare instructions act like contacts — place them on the left side of a rung.

Available Compare Instructions

InstructionSymbolPurpose
EQ

EQ

Source A

sourceA

Source B

sourceB

Passes power when sourceA equals sourceB.
NE

NE

Source A

sourceA

Source B

sourceB

Passes power when sourceA does not equal sourceB.
GT

GT

Source A

sourceA

Source B

sourceB

Passes power when sourceA is greater than sourceB.
GE

GE

Source A

sourceA

Source B

sourceB

Passes power when sourceA is greater than or equal to sourceB.
LT

LT

Source A

sourceA

Source B

sourceB

Passes power when sourceA is less than sourceB.
LE

LE

Source A

sourceA

Source B

sourceB

Passes power when sourceA is less than or equal to sourceB.

Operands

NameType
sourceADINT | REAL
sourceBDINT | REAL

Compare instructions do not operate on BOOL — use XIC / XIO for boolean checks.

Example — Temperature Alarm

Turn on a cooling fan when temperature exceeds the setpoint.

GT(Temperature,75)OTE(Fan)

Example — Value in Range

Energize InRange only when Pressure is between 20 and 100 inclusive.

GE(Pressure,20)LE(Pressure,100)OTE(InRange)

Common Mistakes

  • Comparing a BOOL tag — use XIC / XIO instead.
  • Using EQ on REAL values — fragile due to floating-point rounding. Prefer GE / LE with a small tolerance, or LIMIT.