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

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

Advertisement

The following example is for when In1 is INT#3, In2 is INT#5 and In3 is INT#10. The value of variable
abc will be FALSE.
LD
EN
INT#3
In1
INT#5
In2
INT#10
In3
Compared to see if they are equivalent.
In1
INT#3
In2
Additional Information
• The functions of the EQ instruction and the = instruction are exactly the same. Use the form that is
easier to use.
• When you compare TIME, DT, or TOD data, adjust the data so that the precision of the values is the
same. Use the following instructions to adjust the precision of the values: TruncTime (page 2-651),
TruncDt (page 2-655), and TruncTod (page 2-659).
Precautions for Correct Use
• If the data types of In1 to InN are different, they will be expanded to a data type that includes the
ranges of all of the data types.
• You cannot compare bit string data (BYTE, WORD, DWORD, or LWORD) with integers. You cannot
compare bit string data to real number data (SINT, INT, DINT, LINT, USINT, UDINT, ULINT, REAL,
and LREAL).
• Signed integers (SINT, INT, DINT, and LINT) cannot be compared to unsigned integers (USINT, UINT,
UDINT, and ULINT).
• Always compare data with the same data type for TIME, DATE, TOD, DT, and STRING data. If vari-
ables with different data types are specified, a building error will occur.
• You can compare enumerations only to other enumerations. The data types must also be the same to
compare enumerations.
• Two values that are positive infinity or two values that are negative infinity are equivalent.
• If any of the values of In1 to InN is nonnumeric data, the value of Out is FALSE.
• If this instruction is used in a ladder diagram, the value of Out changes to FALSE if an error occurs in
the previous instruction on the rung.
• If In1 to InN are real numbers, the desired results may not be achieved due to rounding error. Do not
use this instruction to check if two values are equal when one or more of them is a real number. Use
a value comparison instruction and check to see if the difference in the absolute values is within the
allowable range. For example, the following programming can be used to check to see if the sum of
REAL variables real_a and real_b is equal to 0.1. If the value of BOOL variable boolv is TRUE, the
two values are considered to be equal.
boolv := (ABS((real_a + real_b) - 0.1) < threshold);
threshold: Value for allowable range

NY-series Instructions Reference Manual (W560)

ST
abc:=(INT#3=INT#5)&(INT#5=INT#10);
abc
EQ
The EQ instruction determines if In1 to In3 are all equivalent.
If they are different, the value of abc will be FALSE.
Different.
INT#5
In3
INT#10
2 Instruction Descriptions
Out=abc
FALSE
2
2-93

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents