11 - 474 11 - 474
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Available only in execution mode
ZWAIT EVENT
Instruction
Z WAIT EVENT
• Pauses the program execution until the specified event is generated.
ZWAIT EVENT <event number>[,<timeout value>]
Syntax
event number
• • • •
Specify the event number of the event whose
generation is to be waited for.
timeout value
Specify the maximum time that the program can wait
for the event to be generated in the format
"HH:MM:SS:R."
HH: Hours
MM: Minutes
SS: Seconds
R: 100 ms
(0 to 23)
(0 to 59)
(0 to 59)
(expressing 0 to 900 ms with
numbers from 0 to 9)
Examples
ZWAIT EVENT 1
• • • •
Pauses the program execution until the event
corresponding to event number 1 is generated.
ZWAIT EVENT 3,
"00:01:00:0"
Pauses the program execution until the event
corresponding to event number 3 is generated. If the
event is not generated when one minute has elapsed
after the program is paused, a timeout error is
generated.
Description
• The ZWAIT EVENT instruction pauses the program execution until the event specified in
<event number> is generated (the program is put into the wait status).
• Specify the event number of the event whose generation is to be waited for in <event
number>. The event number should be the one given to the event at the definition.
• Specify the maximum time that the program can wait for the event to be generated using
the format shown below (the program stops the execution while waiting).
"HH:MM:SS:R"
HH
• • • •
Hours ("0" to "23")
MM
• • • •
Minutes ("0" to "59")
SS
• • • •
Seconds ("0" to "59")
R
• • • •
ms (expressing 0 to 900 ms
with numbers from 0 to 9)
If the specification of <timeout value> is omitted or "0:0:0:0" is specified, the program waits
for an infinite time.
• The ZWAIT EVENT instruction is used when it is desired to synchronize the executions of
two or more programs by making a program that executes this instruction wait for an event
to be generated from another program.
• In order to resume the execution of the program that executes the ZWAIT EVENT
instruction, it is necessary to enable the generation of the target event using the ZEVENT
instruction in one of the programs before generating the event.
• Define the event whose generation should be waited using the DEF ZEVENT instruction in
advance.
• It is possible to make multiple programs wait for the same event at the same time.