Mitsubishi QD51 Programming Manual page 371

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 reads the comment data from the PLC CPU and saves it on a memory
card
110 ' (Comment capacity: 3 k bytes)
120 OPEN"0:PROG10.DAT"FOR OUTPUT AS #1
130 DIM TBL%(10),A%(150)
140 TBL%(0)=255
150 TBL%(1)=10
160 TBL%(3)=128
170 FOR J=&HO TO &HB80 STEP 128
180 TBL%(2)=J
190 PCRD TBL%( ),A%( )
200 FOR I=0 TO 127
210 PRINT #1,A%(I)
220 NEXT I
230 NEXT J
240 CLOSE #1 :'Closes the file
250 END
(2) Program example for a format 2 control table
100 ' A program example that reads the comment data from the PLC CPU and saves it on a memory
card
110 ' (Comment capacity: 3 k bytes)
110 OPEN"0:PROG10.DAT"FOR OUTPUT AS #1
120 DIM TBL%(10),A%(150)
130 TBL%(0)=256
140 TBL%(1)=1
150 TBL%(2)=1
160 TBL%(4)=10
170 TBL%(6)=128
180 FOR J=&HO TO &HB80 STEP 128
190 TBL%(5)=J
200 PCRD TBL%( ),A%( )
210 FOR I=0 TO 127
220 PRINT #1,A%(I)
230 NEXT I
240 NEXT J
250 CLOSE #1
260 END
11 - 201
:
'Opens the sequential file
:
'Defines arrays
:
'Specifies the station number to
communicate with to the local station
:
'Specifies to read comment data
:
'Specifies the number of bytes to be read
:
'Specifies the starting address of the
comment data
:
'Executes the read operation
:
'Writes to the sequential file
:
'Opens the sequential file
:
'Defines arrays
:
'Specifies a format 2 control table
:
'Specifies network number 1
:
'Specifies station number 1
:
'Specifies to read comment data
:
'Specifies the number of bytes to be read
:
'Specifies the starting address of the
comment data
:
'Executes the read operation
:
'Writes to the sequential file
:
'Closes the file
MELSEC-Q
11 - 201

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents