Mitsubishi QD51 Programming Manual page 526

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program writes data to extension registers (TASK 1)
20 ZODV O
30 DIM A%(9)
40 DEF ZEVENT 1
50 ZEVENT ENABLE 1
60 A$="TASK 1 writing data"
70 B$="TASK 1 writing data completed"
80 FOR I=1 TO 10
90 A%(I-1)=I
100 NEXT I
110 ZRESERVE 1
120 LOCATE 0,2
130 PRINT A$
140 PUTMEM TO W@(ED,0),0 FROM A%( ),0,20
150 PRINT B$
160 ZSIGNAL 1
170 PRINT "Data written"
180 FOR I=1 TO 10
190 PRINT A%(I-1),
200 NEXT I
210 ZRELEASE 1
220 END
10 ' This program reads data from extension registers (TASK 2)
20 ZODV O
30 DIM B%(9)
40 C$="TASK 2 reading data"
50 D$="TASK 2 reading data completed"
60 FOR I=0 TO 9
70 B%(I)=0
80 NEXT I
90 ZWAIT EVENT 1
100 ZRESERVE 1
110 LOCATE 0,15
120 PRINT C$
130 GETMEM TO B%( ),0 FROM W@(ED,0),0,20
140 PRINT D$
150 PRINT "Data read"
160 FOR I=1 TO 10
170 PRINT B%(I-1),
180 NEXT I
190 ZRELEASE 1
200 END
11 - 356
REMARK
See the GETMEM instruction and Section 8.5.1.
:
'Displays on the console
:
'Defines an array
:
'Defines an event
:
'Enables event generation
:
'Defines an message
:
'Writes the data
:
'Reserves resource number 1
:
'Specifies the display position
:
'Displays the message
:
'Executes the write operation
:
'Displays the message
:
'Event generation
:
'Displays the data written
:
'Releases resource number 1
:
'Ends the execution
:
'Displays on the console
:
'Defines an array
:
'Defines a message
:
'Stores dummy values
:
'Waits for event generation
:
'Reserves resource number 1
:
'Specifies the display position
:
'Displays the message
:
'Executes the read operation
:
'Displays the message
:
'Displays the data read
:
'Releases resource number 1
:
'Ends the execution
MELSEC-Q
11 - 356

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents