Mitsubishi QD51 Programming Manual page 608

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program exchanges data between tasks via the message ports (TASK 1)
20 DEF ZEVENT 1
30 ZEVENT ENABLE 1
40 A$=SPACE$(80)
50 ZMESSAGE 1 LEN=80
60 ZMESSAGE OPEN 1
70 ZSIGNAL 1
80 ZMESSAGE PUT 1,"MESSAGE FOR TASK2"
90 ZMESSAGE CLOSE 1
100 ZMESSAGE 2 LEN=80
110 ZMESSAGE OPEN=2
120 ZMESSAGE GET 2,A$
130 ZMESSAGE CLOSE 2
140 PRINT A$
150 ZMESSAGE KILL 1
160 ZMESSAGE KILL 2
170 END
10 ' This program exchanges data between tasks via the message ports (TASK 2)
20 ZWAIT EVENT 1
30 B$=SPACE$(80)
40 ZMESSAGE OPEN 1
50 ZMESSAGE GET 1,B$
60 ZMESSAGE CLOSE 1
70 ZMESSAGE OPEN=2
80 ZMESSAGE PUT 2,"MESSAGE FOR TASK1"
90 ZMESSAGE CLOSE 2
100 LOCATE 0,1
110 PRINT B$
120 END
11 - 438
REMARK
• See Sections 8.2 and 8.4, as well as the ZURGENCY instruction for details about
the program priority.
• See the ZMESSAGE CLOSE, ZMESSAGE GET, ZMESSAGE KILL, ZMESSAGE
OPEN and ZMESSAGE PUT instructions, and Section 8.5.2.
:
' Defines event 1
:
' Enables the generation of event 1
:
' Stores dummy data in the character
variable
:
' Defines message port 1
:
' Opens message port 1
:
' Generates event 1
:
' Writes the message
:
' Closes message port 1
:
' Defines message port 2
:
' Opens message port 2
:
' Reads the message
:
' Closes message port 2
:
' Displays the result
:
' Erases message port 1
:
' Erases message port 2
:
' Waits for the generation of event 1
:
' Stores dummy data in the character
variable
:
' Opens message port 1
:
' Reads the message
:
' Closes message port 1
:
' Opens message port 2
:
' Writes the message
:
' Closes message port 2
:
' Changes the display position
:
' Displays the result
MELSEC-Q
11 - 438

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents