11 - 357 11 - 357
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
RDSET
Function
ReaD SET
• Reads one bit data from the specified bit of an integer array variable.
RDSET(<integer expression>,<array element>)
integer expression
• • • •
Specify which bit to read from the specified integer
array, using an integer from -32768 to 65535.
Syntax
array element
• • • •
Specify an element of a one-dimensional integer
array from which data is read.
B=RDSET(12,A%(0))
• • • •
Reads the value of the 12th bit counting from the 0th
bit of A%(0) to B.
b15
to
b0
to
A%(0)
Reads the value of the 12th bit.
0 1
0
0 1 1 0 1
0 0
0
1 1 1 1 0
b8b7
Examples
B=RDSET(40,A%(0))
• • • •
Reads the value of the 40th bit counting from the 0th
bit of A%(0) to B.
b15
to
b0
to
1 1
0
0 1 1 0 0
0 1
0
0 1 1 0 0
b8 b7
b31
to
b16
to
0 1
1
1 0 1 0 0
1 1
1
0 0 0 0 1
b24 b23
b47
to
b32
to
1 1
0
1 1 0 1 0
1 0
0
0 1 1 0 0
b40 b39
A%(1)
A%(0)
A%(2)
Reads the value of the 40th bit counting
from the 0th bit of A%(0).
Description
• The RDSET function reads the bit data at a position specified in <integer expression> in
the one-dimensional integer array variable specified in <array element>.
• In the bit specification by <integer expression>, it is possible to specify any bit in the array
elements relative to the 0th bit of the specified array element.
For example, if values from 0 to 15 are specified, they correspond to each bit of the
specified array element. If values from 16 to 31 are specified, they correspond to each bit
in the element next to the specified array element (see Example above).
An “Illegal function call” error occurs if the specified value indicates a bit position that
exceeds the total number of bits contained in an array variable defined by the DIM
instruction.
• Only a one-dimensional integer array variable can be specified in <array variable>.
If a variable other than a one-dimensional integer array variable is specified, an “Illegal
function call” error occurs.