Mitsubishi QD51 Programming Manual page 504

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
(3) Program example for a format 3 control table
100 'A program example that writes data nonsequentially to devices in a Q/QnA series PLC CPU's
110 DIM TBL%(20),A%(10)
120 TBL%(0)=257
130 TBL%(1)=1
140 TBL%(2)=1
150 TBL%(4)=516
160 TBL%(5)=&H3E3
170 TBL%(6)=&H101
180 TBL%(7)=&H1
190 TBL%(8)=168
200 D!=0
210 GOSUB 430
220 TBL%(9)=l%
230 TBL%(10)=H%
240 TBL%(11)=0
250 TBL%(12)=0
260 TBL%(13)=144
270 D!=0
280 GOSUB 430
290 TBL%(14)=L%
300 TBL%(15)=H%
310 TBL%(16)=0
320 TBL%(17)=0
330 TBL%(18)=168
340 D!=8000
GOSUB 430
360 TBL%(19)=L%
370 TBL%(20)=H%
380 TBL%(21)=0
390 TBL%(22)=0
400 A%(0)=100:A%(1)=200:A%(2)=300
410 PCRD TBL%( ),A%( )
420 END
430 H!=INT(D!/65536!)
440 L!=D!-H!*65536!
450 H$=RIGHT$("0000"+HEX$(H!),4)
460 L$=RIGHT$("0000"+HEX$(L!),4)
470 L%=VAL("&H"+L$)
480 H%=VAL("&H"+H$)
490 RETURN
11 - 334
device memory
:
'Defines arrays
:
'Specifies a format 3 control table
:
'Specifies network number 1
:
'Specifies station number 1
:
'Specifies to write data to individual devices
of the Q/QnA series PLC CPU
:
'Specifies the requested CPU (fourth CPU)
:
'Writes to one bit device point and one
word device point
:
'Writes to one double-word device point
:
'Specifies data registers (D)
:
'Specifies device number 0
:
'Stores the lower digit of the device number
:
'Stores the higher digit of the device
number
:
'Specifies word units as processing unit
:
'Fixed value
:
'Specifies internal relays (M)
:
'Specifies device number 0
:
'Stores the lower digit of the device number
:
'Stores the higher digit of the device
number
:
'Specifies bit units as processing unit
:
'Fixed value
:
'Specifies data registers (D)
:
'Specifies device number 8000
:
'Stores the lower digit of the device number
:
'Stores the higher digit of the device
number
:
'Specifies double-word units as processing
unit
:
'Fixed value
:
'Specifies the values to write
:
'Executes the write operation
:
'Splits into lower and higher digits
MELSEC-Q
11 - 334

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents