Function
The LIMIT instruction limits the value of data to limit In according to the maximum value, MX, and the
minimum value, MN. The value of processing result Out is as shown below.
Value of In
In < MN
MN ≤ In ≤ MX
MX < In
The following example is for when MN is INT#−10 and MX is INT#20.
LD
INT#−10
abc
INT#20
MX=INT#20
Precautions for Correct Use
• In, MN, MX, and Out may be different data types, but observe the following precautions.
• Set the valid range of Out to include the valid ranges of In, MN, and MX.
• Do not combine signed integers (SINT, INT, DINT, and LINT) together with unsigned integers
(USINT, UINT, UDINT, and ULINT) for In, MN, and MX.
• An error occurs in the following case. ENO will be FALSE, and Out will not change.
• The value of MX is smaller than the value of MN.
NJ-series Instructions Reference Manual (W502)
Value of Out
MN
In
MX
LIMIT
EN
ENO
def
MN
In
MX
Out=def
MN=INT#−10
ST
def:=LIMIT(INT#−10, abc, INT#20);
In=abc
2 Instruction Descriptions
2
2-303