11 - 332 11 - 332
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
(1) Program example for a format 1 control table
100 'A program example that writes data nonsequentially to devices in a Q/QnA series PLC CPU’s
device memory
110 DIM TBL%(20),A%(10)
:
'Defines arrays
120 TBL%(0)=255
:
'Specifies the station number to
communicate with to the local station
130 TBL%(1)=516
:
'Specifies to write data nonsequentially to
the devices of the Q/QnA series PLC CPU
140 TBL%(2)=&H101
:
'Writes to one bit device point and one
word device point
150 TBL%(3)=&H1
:
'Writes to one double-word device point
160 TBL%(4)=168
:
'Specifies data registers (D)
170 D!=0
:
'Specifies device number 0
GOSUB 400
190 TBL%(5)=L%
:
'Stores the lower digit of the device number
200 TBL%(6)=H%
:
'Stores the higher digit of the device
number
210 TBL%(7)=0
:
'Specifies word units as processing unit
220 TBL%(8)=0
:
'Fixed value
230 TBL%(9)=144
:
'Specifies internal relays (M)
240 D!=0
:
'Specifies device number 0
250 GOSUB 400
260 TBL%(10)=L%
:
'Stores the lower digit of the device number
270 TBL%(11)=H%
:
'Stores the higher digit of the device
number
280 TBL%(12)=0
:
'Specifies bit units as processing unit
290 TBL%(13)=0
:
'Fixed value
300 TBL%(14)=168
:
'Specifies data registers (D)
310 D!=8000
:
'Specifies device number 8000
320 GOSUB 400
330 TBL%(15)=L%
:
Stores the lower digit of the device number
340 TBL%(16)=H%
:
'Stores the higher digit of the device
number
350 TBL%(17)=0
:
'Specifies double-word units as processing
unit
360 TBL%(18)=0
:
'Fixed value
370 A%(0)=100:A%(1)=200:A%(2)=300
:
'Specifies the values to write
380 PCRD TBL%( ),A%( )
:
'Executes the write operation
390 END
400 H!-INT(D!/65536!)
:
'Splits into lower and higher digits
410 L!=D!-H!*65536!
420 H$=RIGHT$(“0000”+HEX$(H!),4)
430 L$=RIGHT$(“0000”+HEX$(L!),4)
440 L%=VAL(“&H+L$)
450 H%=VAL(“&H”+H$)
460 RETURN
Содержание 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...