8 - 7 8 - 7
MELSEC-Q
8 MULTITASK PROCESSING
(2) Execution order of the instructions when the event control is
performed
The following shows the execution order of the instructions when the execution of
the BASIC program is being controlled by the events (execution start, execution
resume). Execute in the order starting from (1).
(a) When synchronizing the execution between BASIC programs
B
B
B
A
A
1) DEF ZEVENT to Defines the event
2) ZEVENT ENABLE to Enables the event to occur
3) ZWAIT EVENT Waiting for the event to occur.
4) ZSIGNAL The event occurs.
Synchronization
BASIC
program (A)
BASIC
program (B)
As shown above, execute steps 1) and 2) in one program and then
generate the event while one of the programs is waiting for the event to
occur. If 4) is executed before 3), the execution cannot be synchronized.
To prevent the generated event from becoming invalid, apply interlock
between programs whose executions are to be synchronized by using an
extension relay of the communication module, etc.
B
B
A
Synchronization
BASIC
program (A)
BASIC
program (B)
B
A
A
Check whether program B will
be waiting for the event or not.
B%=B @(EM,...)
Extension relay of the
communication module
Notifies that it will be waiting
for the event.
B@(EM,...)=1
OK !