2 - 14 2 - 14
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
2.8.3 Special variables (How to use B@ and W@)
• These variables are used to read/write from/to each device of the communication
module from within BASIC programs.
• There are the following 4 types of special variables.
B@ (EM, expression)
• • • • •
Read/write from/to the extension relays EM.
W@ (ED, expression)
• • • • •
Read/write from/to the registers ED.
B@ (X, expression)
• • • • •
Write to general-purpose inputs X.
W@ (Y, expression)
• • • • •
Read from general-purpose outputs Y.
Refer to the user’s manual for each communication module for details on the extension
relays EM, extension registers ED, general-purpose inputs X, and general-purpose
outputs Y.
Note that it is possible to read and write to/from the special EM and special ED
extension devices.
(1) Reading from and writing to bit devices
B@(EM, expression)
• • • • •
Specify a value between 0 and 1023 for
the expression.
B@(X, expression)
• • • • •
Specify a value between 0 and 1F
H
for the
expression. Since this must be specified in
hexadecimal, place ‘&H’ in front of the
numeric value.
B@(Y, expression)
• Specify a device number in the expression.
When general-purpose inputs X or outputs Y are specified, values between 0
and1F
H
are used regardless of the input/output numbers of the entire system.
The input/output
numbers as seen
from the PLC CPU
A
X
41
(32 points)
AD
51
H
(48 points)
A
X
41
(32 points)
A
Y
41
(32 points)
A
Y
41
(32 points)
A
Y
41
(32 points)
D0 to EF
?
?
General-purpose
inputs/outputs
X, Y
Value specified
in the expression
0 to 1F
A
X
41
(32 points)
40
to 4F
50 to 6F
•
•
•
•
•
•
0 to 1F
20 to 3F
40 to 6F
70 to 8F
90 to AF
B0 to CF