Mitsubishi QD51 Programming Manual page 344

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
(1) Program example for format 1 control table
100 ' A program example that reads device memory data of the PLC CPU
110 DIM TBL%(10),A%(20)
120 TBL%(0)=255
130 TBL%(1)=1
140 TBL%(2)=1
150 TBL%(3)=3
160 TBL%(4)=&H0
170 TBL%(5)=10
180 PCRD TBL%( ),A%( )
190 J=0
200 FOR I=0 TO 72 STEP8
210 A=RDSET(I,A%(0))
220 IF A=1 THEN PRINT"M";J;"=ON"ELSE PRINT"M";J;"=OFF"
230 J=J+1
240 NEXT I
250 END
(2) Program example for format 2 control table
100 ' A program example that reads device memory data of the PLC CPU
110 DIM TBL%(10),A%(20)
120 TBL%(0)=256
130 TBL%(1)=1
140 TBL%(2)=1
150 TBL%(4)=1
160 TBL%(5)=1
170 TBL%(6)=3
180 TBL%(7)=&H0
190 TBL%(8)=10
200 PCRD TBL%( ),A%( )
210 J=0
220 FOR I=0 TO 72 STEP8
230 A=RDSET(I,A%(0))
240 IF A=1 THEN PRINT"M";J;"=ON"ELSE PRINT"M";J;"=OFF"
250 J=J+1
260 NEXT I
270 END
11 - 174
:
'Defines arrays
:
'Specifies the station number to
communicate with to the local station
:
'Specifies to read device memory data
:
'Specifies bit units
:
'Specifies internal relays M
:
'Specifies the starting device number of the
device memory to be read
:
'Specifies the number of points to be read
:
'Executes the read operation
:
'Reads the status of M
:
'Adds 1 to J
:
'Defines arrays
:
'Specifies a format 2 control table
:
'Specifies network number 1
:
'Specifies station number 1
:
'Specifies to read device memory data
:
'Specifies bit units
:
'Specifies internal relays M
:
'Specifies the starting device number of the
device memory to be read
:
'Specifies the number of points to be read
:
'Executes the read operation
:
'Reads the status of M
:
'Adds 1 to J
MELSEC-Q
11 - 174

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents