Mitsubishi MELFA CR1D Instruction Manual page 133

Table of Contents

Advertisement

4.2.4 Precautions for creating multitask program
(1) Relationship between number of tasks and processing time
During multitask operation, it appears as if several robot programs are being processed concurrently. How-
ever, in reality, only one line is executed at any one time, and the processing switches from program to pro-
gram (it is possible to change the number of lines being executed at a time. See the section for the "SLTn"
parameter in "Setting Functions by Parameters" on page 247). This means that if the number of tasks
increases, the overall program execution time becomes longer. Therefore, when using multitask operation,
the number of tasks should be kept to a minimum. However, programs of other tasks executing movement
instructions (the Mov and Mvs instructions) are processed at any time.
(2) Specification of the maximum number of programs executed concurrently
The number of programs to be run in parallel is set with parameter TASKMAX. (The default value is 8.) To
run more than 8 programs in parallel, change this parameter.
(3) How to pass data between programs via external variables
Data is passed between programs being executed in multitask operation via program external variables
such as M_00 and P_00 (refer to
ables (refer to
Page 138, "4.3.24 User-defined external
example, the on/off status of input signal 8 is judged by the program specified in task slot 2. Then this pro-
gram notifies the program specified in task slot 1 that the signal is turned on by means of the external vari-
able M_00.
<Slot 1>
1 M_00=0
2 *L
3 If M_00=0 Then *L
4 M_00=0
:
<Slot 2>
(Program of signals and variables)
1 If M_In(8) <> 1 Then *A1
3 *A1
:
(4) Confirmation of operating status of programs via robot status variables
The status of the program running with multitask can be referred to from any slot using the robot status vari-
ables (M_Run, M_Wai, M-ERR).
Example) M1 = M_Run (2) The operation status of slot 2 is obtained.
Page 140, "4.3.26 Robot status variables"
(5) The program that operates the robot is basically executed in slot 1.
The program that describes the robot arm's movement, such as with the Mov commands, is basically set
and executed in slot 1. To run the program in a slot other than slot 1, the robot arm acquisition and release
command (GetM, RelM) must be used. Refer to
in this manual for details on the commands.
(6) How to perform the initialization processing via constantly executed programs
Programs specified in task slots whose start condition is set to ALWAYS are executed continuously (repeat-
edly) if the operation mode is set to REP. Therefore, in order to perform the initialization processing via such
programs, they should be programmed in such a way that the initialization processing is not executed more
than once, for example by setting an initialization complete flag and perform a conditional branch based on
Page 137, "4.3.22 External
variables"). An example is shown below. In this
; Substitute 0 in M_00
; Wait for M_00 value to change from 0.
; Substitute 0 in M_00
; Proceed with the target work.
; Repeat from step 2.
; Branch to line 30 if input signal 8 is not ON.
; Substitute 1 in M_00
; Proceed with the target work.
for details on the robot status variables.
Page 152, "4.11 Detailed explanation of command words"
variables") and the user-defined external vari-
4MELFA-BASIC IV
Multitask function 4-120

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melfa cr2dMelfa cr3d

Table of Contents