4MELFA-BASIC IV
Detailed explanation of command words
4-260
XRun (X Run)
[Function]
This instruction executes concurrently the specified programs from within a program.It is used during
multitask operation.
[Format]
[Terminology]
<Slot No.>
Specify a slot number in the range from 1 to 32 as a constant or variable.
<Program Name>
Designate the program name.
<Operation Mode> 0 = Continuous operation,
1 = Cycle stop operation. If the operation mode is omitted, the current operation mode
will be used. Specify this argument using a constant or a variable.
[Reference Program]
(1) When the program of execution is specified by XRun command (continuous executing).
1 XRun 2,"1"
' Start the program 1 with slot 2.
2 Wait M_Run(2)=1
' Wait to have started.
(2) When the program of execution is specified by XRun command (cycle operation)
1 XRun 3,"2",1
'
Start the program 2 with slot 3 in the cycle operation mode
2 Wait M_Run(3)=1
' Wait to have started.
(3) When the program of execution is specified by XLoad command (continuous executing).
1 XLoad 2, "1"
' Select the program 1 as the slot 2.
2 *L2
3 If C_Prg(2)<>"1" Then GoTo *L3
' Wait for load complete.
4 XRun 2
' Start the slot 2.
(4) When the program of execution is specified by XLoad command (cycle operation)
1 XLoad 3, "2"
' Select the program 2 as the slot 3.
2 *L2
3 If C_Prg(2)<>"1" Then GoTo *L2
' Wait for load complete
4 XRun 3, ,1
' Start the program 1 with cycle operation.
[Explanation]
(1) An error occurs at execution if the specified program does not exist.
(2) If the designated slot No. is already in use, an error will occur at execution.
(3) If a program has not been loaded into a task slot, this instruction will load it. It is thus possible to operate
the program without executing the XLoad instruction.
(4) If XRun is executed in the "Pausing" state with the program stopped midway, continuous execution will
start.
(5) Designate the program name in double quotations.
(6) If the operation mode is omitted, the current operation mode will be used.
(7) If it is used in programs that are constantly executed, change the value from 0 to 7 in the ALWENA
parameter, and power ON the controller again.
(8) If XRun is executed immediately after executing XLoad, an error may occur while loading a program. If
necessary, perform a load completion check as shown on the 3rd step of both statement examples [3]
and [4].
[Related instructions]
,
,
[Related parameter]
ALWENA
[Related system variables]
(Slot number) (1: Executing, 0: Not executing)
XRun[]<Slot No.> [, ["<Program Name>"] [, <Operation Mode>] ]