Ny-Series Instructions Reference Manual (W560 - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

2 Instruction Descriptions
Function
The Cmp instruction compares two values (In1 and In2) and outputs flag values.
The values of the flags are as follows:
Flag
OutEQ
OutGT
OutGE
OutNE
OutLT
OutLE
The following example is for when In1 is INT#10 and In2 is INT#20. The values of variables def, ghi, and
jkl will be FALSE, and the values of abc, mno, pqr, and stu will be TRUE.
LD
INT#10
INT#20
In1 and In2 are compared.
In1
INT#10
In2
Precautions for Correct Use
• If the data types of In1 and In2 are different, the smaller one is expanded to a data type that includes
the ranges of both of the data types.
• If In1 and In2 are real numbers, error may cause unexpected processing results. This can occur, for
example, when they contain non-terminating decimal numbers.
• Signed integers (SINT, INT, DINT, and LINT) cannot be compared to unsigned integers (USINT, UINT,
UDINT, and ULINT).
• Two values that are positive infinity or two values that are negative infinity are equivalent.
• If the value of either In1 or In2 is nonnumeric data, the values of OutEQ, OutGT, OutGE, OutNE,
OutLT, and OutLE are FALSE.
2-108
If In1 equals In2, the flag shows TRUE. Otherwise the flag shows FALSE.
If In1 is greater than In2, the flag shows TRUE. Otherwise the flag shows
FALSE.
If In1 is greater than or equal to In2, the flag shows TRUE. Otherwise the
flag shows FALSE.
If In1 is not equal to In2, the flag shows TRUE. Otherwise the flag shows
FALSE.
If In1 is less than In2, the flag shows TRUE. Otherwise the flag shows
FALSE.
If In1 is less than or equal to In2, the flag shows TRUE. Otherwise the flag
shows FALSE.
Cmp
EN
ENO
abc
In1
def
In2
OutEQ
ghi
OutGT
jkl
OutGE
mno
OutNE
pqr
OutLT
stu
OutLE
The Cmp instruction compares In1 and In2.
The results are given below for the various criteria.
Out
Always TRUE
OutEQ
FALSE because In1 does not equal In2.
OutGT
FALSE because In1 is not greater than In2.
OutGE
FALSE because In1 is not greater than or equal to In2.
OutNE
TRUE because In1 does not equal In2.
OutLT
TRUE because In1 is less than In2.
INT#20
OutLE
TRUE because In1 is less than or equal to In2.
Value
ST
abc:=Cmp(INT#10, INT#20, def, ghi, jkl, mno, pqr, stu);

NY-series Instructions Reference Manual (W560)

Out=abc
TRUE
OutEQ=def
FALSE
OutGT=ghi
FALSE
OutGE=jkl
FALSE
OutNE=mno
TRUE
OutLT=pqr
TRUE
OutLE=stu
TRUE

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents