2-311
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Selection Instructions
2
MAX and MIN
z MAX
The MAX instruction finds the largest value of two to five data to process, In1 to InN.
z MIN
The MIN instruction finds the smallest value of two to five data to process, In1 to InN.
The following example is for the MAX instruction when In1 is INT#10, In2 is INT#5, In3 is INT#23, In4 is
INT#14, and In5 is INT#−5.
To find the largest or smallest of six or more values, use the AryMax or AryMin instruction (page 2-312).
• In1 to InN and Out may be different data types, but observe the following precaution.
• Set the valid range of Out to include the valid ranges of In1 to InN.
• Do not combine signed integers (SINT, INT, DINT, and LINT) together with unsigned integers
(USINT, UINT, UDINT, and ULINT) for In1 to InN.
• If In1 to InN are real numbers, the desired results may not be achieved due to error.
Function
Additional Information
Precautions for Correct Use
abc:=MAX(INT#10, INT#5, INT#23, INT#14, INT#−5);
LD ST
abc
INT#10
INT#5
INT#23
INT#14
INT# −5
MAX
EN ENO
In1
In2
In3
In4
In5
INT#10
In1
INT#5
In2
INT#23 INT#23
In3
INT#14
In4
INT#−5
In5
Out=abc