Chapter 6 Applied Instructions 
6-299 
API 
Instruction code
Operand  Function 
1221  D  LIMIT  P 
S
1
, S
2
, S
3
, D 
Confining the value within the 
bounds 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#  “$”  DF 
16-bit instruction (9 steps) 
32-bit instruction (9 steps) 
  AH500  AH500  AH500 
Symbol: 
   
S
1
:
Minimum output value  Word/Double word 
S
2
:
Maximum output value  Word/Double word 
S
3
:
Input value  Word/Double word 
D 
:
Output value  Word/Double word 
Explanation: 
1.  The input value in S
3
 is compared with the minimum output value in S
1
 and the maximum 
output value in S
2
, and the comparison result is stored in D. 
If the minimum output value in S
1
 is larger than the input value in S
3
, the output value stored in 
D is equal to the minimum output value in S
1
. 
If the maximum output value in S
2
 is less than the input value in S
3
, the output value stored in 
D is equal to the maximum output value in S
2
. 
3
 is within the range between the minimum output value in S
1
 and the 
maximum output value in S
2
, the output value stored in D is equal to the input value in S
3
. 
If the minimum output value in S
1
 is larger than the maximum output value in S
2
is not executed. 
2.  Only the 32-bit instructions can use the 32-bit counter. 
Example: 
  When X0.0 is ON, the state of X1 is converted into the binary value, and the conversion result 
is stored in D0. Besides, the value stored in D0 is compared with 500 and 5000, and the 
comparison result is stored in D1.