2-89
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Comparison Instructions
2
LT (<), LE (<=), GT (>), and GE (>=)
* If you omit the input parameter that connects to InN, the default value is not applied, and a building error will occur. For
example, if N is 3 and the input parameters that connect to In1 and In2 are omitted, the default values are applied, but if the
input parameter that connects to In3 is omitted, a building error will occur.
These instructions compare the values of In1 to InN (N = 2 to 5).
The output value Out is shown below for each instruction.
The following example shows the LE instruction when In1 is INT#3, In2 is INT#5 and In3 is INT#10. The
value of variable abc will be TRUE.
• The functions of the LT and < instructions, the LE and <= instructions, the GT and > instructions, and
the GE and >= instructions are exactly the same. Use the form that is easier to use.
• Use the LTascii, LEascii, GTascii, and GEascii instructions (page 2-95) to compare the sizes of text
strings.
Variables
Name Meaning I/O Description Valid range Unit Default
In1 to InN Comparison
data
Input Values to compare, N = 2 to
5
Depends on data type.
--- 0*
Out Comparison
result
Output Comparison result Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 to InN OKOKOKOKOKOKOKOKOKOK
Out OK
Function
Instruction Value of Out
LT (<) If In1 < In2 < ... < InN, Out is TRUE. Otherwise, it is FALSE.
LE (<=) If In1 <= In2 <= ... <= InN, Out is TRUE. Otherwise, it is FALSE.
GT (>) If In1 > In2 > ... > InN, Out is TRUE. Otherwise, it is FALSE.
GE (>=) If In1 >= In2 >= ... >= InN, Out is TRUE. Otherwise, it is FALSE.
Additional Information
abc:=(INT#3<= INT#5)&(INT#5<=INT#10);
LD ST
INT#3
INT#5
INT#10
abc
LE
EN
In1
In2
In3