11 - 54 11 - 54
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
DEF ZEVENT
Instruction
DEFine Z EVENT
• Defines an event for synchronizing execution between the programs.
• Defines an event by the expansion relay (EM) of the communication module.
DEF ZEVENT (event number)
DEF ZEVENT (event number), <device>
event number
• • • •
Specify a number that represents the event defined
by this instruction.
Syntax
device
• • • •
Specify a communication module’s expansion relay
(EM) that generates an event by turning ON.
DEF ZEVENT 1
• • • •
Defines an event as event number 1 that is
generated by the ZSIGNAL instruction in order to
synchronize between the programs.
Examples
DEF ZEVENT 3, “EM0001”
• • • •
Defines an event, which is generated when the
communication module’s expansion relay EM0001 is
turned ON, as event number 3.
Description
• Defines various events that are used for multitask operations.
• An event is a signal for controlling another BASIC program from a BASIC program.
Definition of an event generated by the ZSIGNAL instruction
• Defines an event for synchronizing execution with another BASIC program. In this case,
specify only <event number> and do not specify <device>.
Program A
ZSIGNAL 1
Program B
ZWAIT EVENT 1
Event occurs
(Resume execution)
DEF ZEVENT 1
ZEVENT ENABLE 1
2)
2)
1)
1)
1) and 2) indicate the range
of execution during the same
period of time when two
programs are running
concurrently.
• Events generated by the ZSIGNAL instruction are generated only by the ZSIGNAL
instruction. After defined by the DEF ZEVENT instruction, this event is used for resuming
execution of a BASIC program that is waiting for the event, after enabling this event by the
ZEVENT instruction and executing the ZSIGNAL instruction.