11 - 438 11 - 438
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program exchanges data between tasks via the message ports (TASK 1)
20 DEF ZEVENT 1
:
' Defines event 1
30 ZEVENT ENABLE 1
:
' Enables the generation of event 1
40 A$=SPACE$(80)
:
' Stores dummy data in the character
variable
50 ZMESSAGE 1 LEN=80
:
' Defines message port 1
60 ZMESSAGE OPEN 1
:
' Opens message port 1
70 ZSIGNAL 1
:
' Generates event 1
80 ZMESSAGE PUT 1,"MESSAGE FOR TASK2"
:
' Writes the message
90 ZMESSAGE CLOSE 1
:
' Closes message port 1
100 ZMESSAGE 2 LEN=80
:
' Defines message port 2
110 ZMESSAGE OPEN=2
:
' Opens message port 2
120 ZMESSAGE GET 2,A$
:
' Reads the message
130 ZMESSAGE CLOSE 2
:
' Closes message port 2
140 PRINT A$
:
' Displays the result
150 ZMESSAGE KILL 1
:
' Erases message port 1
160 ZMESSAGE KILL 2
:
' Erases message port 2
170 END
10 ' This program exchanges data between tasks via the message ports (TASK 2)
20 ZWAIT EVENT 1
:
' Waits for the generation of event 1
30 B$=SPACE$(80)
:
' Stores dummy data in the character
variable
40 ZMESSAGE OPEN 1
:
' Opens message port 1
50 ZMESSAGE GET 1,B$
:
' Reads the message
60 ZMESSAGE CLOSE 1
:
' Closes message port 1
70 ZMESSAGE OPEN=2
:
' Opens message port 2
80 ZMESSAGE PUT 2,"MESSAGE FOR TASK1"
:
' Writes the message
90 ZMESSAGE CLOSE 2
:
' Closes message port 2
100 LOCATE 0,1
:
' Changes the display position
110 PRINT B$
:
' Displays the result
120 END
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.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...