2 - 15 2 - 15
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
• Data, when being read, is represented by the value 1 when ON and 0 when OFF.
• Only bit 0 of the value stored in the specified value or specified variable is valid for
data being written.
b15
b8 b7
b0
to
to
The corresponding device will
turn ON when this is "1".
The corresponding device will
turn OFF when this is "0".
Therefore, data must be stored as integer constants or integer variables during write
operations.
• It is only possible to write when general-purpose inputs X are specified. Also, it is
possible only to read when general-purpose outputs Y are specified.
Example
A=B@(EM, 100)
A%=B@(Y, &H1B)
B@(EM, 200) = A%
B@ (X, &HA) = A%
(2) Reading and writing from/to word devices
W@(ED, expression)
• • • • •
Specify a value between 0 and 1023 for the
expression.
• Specify a device number in the expression.
• If the data is not an integer constant or an integer variable when the write
operation is performed, the value is changed to an integer type and written.
Example
A=W@(ED,50)
• • • • •
The data stored in ED50 will be read and
assigned to single-precision variable A.
A%=W@(ED,50)
• • • • •
The data stored in ED50 will be read and
assigned to integer variable A%.
W@(ED,80)=1234
• • • • •
1234 is written to ED80.
W@(ED,80)=A
• • • • •
The contents of a single-precision real
number A will be written to ED80.
• When reading a 32-bit data value, it should be read into an array variable of
integer type, converted to 32-bit data using CIDB and CISN instructions, and
then used.
Example
100 DIM A% (1)
110 A%(0)=W@(ED,100)
120 A%(1)=W@(ED,101)
• • • • •
Read the 32-bit data stored in
ED100 and ED101 to A%(0) and
A%(1) as 16-bit data respectively.
130 B#=CIDB(A%(0))
• • • • •
The data in A%(0) and A%(1) are
converted to 32-bit data, and then
assigned to B#.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...