Mitsubishi QD51 Programming Manual page 502

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

Advertisement

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
110 DIM TBL%(20),A%(10)
120 TBL%(0)=255
130 TBL%(1)=516
140 TBL%(2)=&H101
150 TBL%(3)=&H1
160 TBL%(4)=168
170 D!=0
GOSUB 400
190 TBL%(5)=L%
200 TBL%(6)=H%
210 TBL%(7)=0
220 TBL%(8)=0
230 TBL%(9)=144
240 D!=0
250 GOSUB 400
260 TBL%(10)=L%
270 TBL%(11)=H%
280 TBL%(12)=0
290 TBL%(13)=0
300 TBL%(14)=168
310 D!=8000
320 GOSUB 400
330 TBL%(15)=L%
340 TBL%(16)=H%
350 TBL%(17)=0
360 TBL%(18)=0
370 A%(0)=100:A%(1)=200:A%(2)=300
380 PCRD TBL%( ),A%( )
390 END
400 H!-INT(D!/65536!)
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
11 - 332
device memory
:
'Defines arrays
:
'Specifies the station number to
communicate with to the local station
:
'Specifies to write data nonsequentially to
the devices of the Q/QnA series PLC 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 - 332

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents