4 - 15 4 - 15
MELSEC-Q
4 THE EXCHANGE BETWEEN THE PLC AND BUFFER MEMORY
4.2.6 Storage area for reading and writing data
The method in which data is read and written from the PLC device must be specified.
Integer type variables, array/character type variables, and arrays can be used as data
storage areas. If arrays are to be used, the arrays must be defined with the DIM
instruction.
(1) When using integer type variables and integer type arrays as a
data storage area
(a) Bit devices
Bit devices are handled in bit units or word units. The following describes
each of them.
• Bit units
When bit units are designated, one point of ON/OFF data of the device
number for each variable will be stored and set in the least significant bit
of the variable for the specified number of points.
The status of the least significant bit is “0” when the corresponding device
is OFF and “1” when it is ON.
Accesses 20 bits of data from
X10 using integer array A%( ).
to
X23
X18
X10
to
X17
1
1 0 1
1
1 0 1
1
1 1 1
0
0 0 0
toX20X1F
0
0 1 1
A% (0)
Corresponds
to X10
to
b0
to
b15
b8 b7
X11
A% (1)
Corresponds
to X12
X13
Ignores bits other than
the least significant bit
of one byte.
When an integer array is
designated, the data is stored
and set from element 0.
Data cannot be stored or set
from other than element 0.
1
0
0
1
• Word Units
When bit devices are designated using word units, the 16 points of
ON/OFF data for each variable will be paired with each bit and stored and
set from the lower bit in the variable.
The status of the each bit is “0” when the corresponding device is OFF
and “1” when it is ON.
M 7 5
to
Corresponds
to M60
to
M %(0)
One word (16 bits) of data is accessed
from M60 using integer variable M%( ).
to
M 6 4
to
M 7 9
M 7 2 M 7 1
to
b0
to
b15
b8 b7
M 6 8M 6 7
The following instructions are used to operate data using bit units corresponding
to the bit device in the BASIC program.
• When the data stored in an integer array is referenced
RDSET instruction
• When the data is set in an integer array
WTSET instruction
……
……………………