2 Instruction Descriptions
2-98
NJ-series Instructions Reference Manual (W502)
Cmp
The Cmp instruction compares two values.
* If you omit the input parameter, the default value is not applied. A building error will occur.
Instruction Name FB/FUN Graphic expression ST expression
Cmp Compare FUN Out:=Cmp(In1, In2, OutEQ,
OutGT, OutGE, OutNE,
OutLT, OutLE);
You can omit Out.
Variables
Name Meaning I/O Description Valid range Unit Default
In1 and In2 Comparison
data
Input Values to compare Depends on data type.
--- *
Out Return value
Output
Always TRUE TRUE only
--- ---
OutEQ Equal flag Equal flag
Depends on data type.
OutGT Greater than
flag
Greater than flag
OutGE Greater than or
equal flag
Greater than or equal flag
OutNE Not equal flag Not equal flag
OutLT Less than flag Less than flag
OutLE Less than or
equal flag
Less than or equal flag
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 and In2 OKOKOKOKOKOKOKOKOKOK
Out OK
OutEQ OK
OutGT OK
OutGE OK
OutNE OK
OutLT OK
OutLE OK
(@)Cmp
EN ENO
In1 Out
In2 OutEQ
OutGT
OutGE
OutNE
OutLT
OutLE