11 - 232 11 - 232
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
• Assign values to %(3) and %(4) ( %(6) and %(7) in case of a format 2 control
table, %(7) and %(8) in case of a format 3 control table) in the following manner.
D!
H!
L!
H$
L$
to
• • • •
• • • •
Device number of the device to be read
Used as work area.
100 H!=INT(D!/65536!)
110 L!=D!-H! 65536!
120 H$=RIGHT$(”0000”+HEX$(H!),4)
130 L$=RIGHT$(”0000”+HEX$(L!),4)
In case of a format 2 control table
140 %(3)=VAL(”&H”+L$)
150 %(4)=VAL(”&H”+H$)
to
• • • •
• • • •
%(6)=VAL(”&H”+L$)
%(7)=VAL(”&H”+H$)
Program Example
(1) Program example for a format 1 control table
100 'A program example that reads the device memory of the Q/QnA series CPU
110 DIM TBL%(10),A%(100)
:
'Defines the arrays
120 TBL%(0)=255
:
'Specifies the station number to
communicate with to the local station
130 TBL%(1)=515
:
'Specifies to read device memory of the
Q/QnA series CP
140 TBL%(2)=144
:
'Specifies internal relays M
150 D!=0
:
'Specifies device number 0
160 H!=INT(D!/65536!)
:
'Splits into lower and higher digits
170 L!=D!-H!*65536!
180 H$=RIGHT$("0000"+HEX$(H!),4)
190 L$=RIGHT$("0000"+HEX$(L!),4)
200 TBL%(3)=VAL("&H"+L$)
:
'Stores the lower digit of the device number
210 TBL%(4)=VAL("&H"+H$)
:
'Stores the higher digit of the device
number
220 TBL%(5)=10
:
'Specifies the number of points to be read
230 PCRD TBL%(),A%()
:
'Executes the read operation
240 I=0
250 FOR I=0 TO 100
260 PRINT HEX$(A%(I))
270 NEXT I
280 END