2-869
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Other Instructions
2
ChkRange
• If In is not a range specification variable, the value of Out changes to 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.
Here, the result of addition i is checked to see if it is within the valid range (10 to 99) of the range speci-
fication variable x. If it is not within the valid range, the value of variable Correct is assigned to variable
x.
Precautions for Correct Use
Sample Programming
LD
i
abc
def
x
Correct
0
0
0
10
0
INT
INT
INT
INT(10..99)
INT
P_On
i
i
i
x
x
Correct
ADD
abc
def
EN ENO
In1
In2
ChkRange
EN
In
Val
x
MOVE
EN ENO
In Out
MOVE
EN ENO
In Out
Variable
Data type
Comment
ST
i := abc+def;
Chk:=ChkRange(i, x);
IF (Chk=TRUE) THEN
x := i;
ELSE
x := Correct;
END_IF;
// Assign i to x if value of i is in range.
// Assign Correct to x if value of i is out of range.
// Check subrange variable.
i
abc
def
Chk
x
Correct
0
0
0
False
10
0
INT
INT
INT
BOOL
INT(10..99)
INT
Variable
Data type
Comment