Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
Comparison Operators¶
Comparison operators compare two values and produce a BOOL result.
IEC 61131-3 |
Section 3.3.1 |
Support |
Supported |
Syntax¶
Operator |
Syntax |
Description |
|---|---|---|
|
|
Equal to |
|
|
Not equal to |
|
|
Less than |
|
|
Greater than |
|
|
Less than or equal to |
|
|
Greater than or equal to |
Description¶
Comparison operators compare two operands of the same type and return a
BOOL value. They apply to integer types (SINT, INT, DINT,
LINT, USINT, UINT, UDINT, ULINT) and floating-point types
(REAL, LREAL).
Equality (=, <>) has lower precedence than the relational operators
(<, >, <=, >=). Both groups have lower precedence than
arithmetic operators.
Example¶
PROGRAM main
VAR
temperature : INT := 75;
setpoint : INT := 70;
overheat : BOOL;
at_target : BOOL;
END_VAR
overheat := temperature > setpoint;
at_target := temperature = setpoint;
END_PROGRAM
See Also¶
Arithmetic Operators — numeric operators
Logical Operators — boolean operators
IF — conditional branching using boolean expressions