4MELFA-BASIC IV
Detailed explanation of command words
4-202
GetM (Get Mechanism)
[Function]
This instruction is used to control the robot by a program other than the slot 1 program when a multi-task is
used, or to control a multi-mechanism by setting an additional axis as a user-defined mechanism.
Control right is acquired by specifying the mechanism number of the robot to be controlled. To release con-
trol right, use the RelM instruction.
[Format]
[Terminology]
<Mechanism No.> 1 to 3, Specify this argument using a numerical or a variable.
The standard system's robot arm is assigned to mechanism 1.
[Reference Program]
(1) Start the task slot 2 from the task slot 1, and control the mechanism 1 in the task slot 2.
Task slot 1.
1 RelM
' Releases the mechanism in order to control mechanism 1 using slot 2.
2 XRun 2,"10"
' Start the program 10 in slot 2.
3 Wait M_Run(2)=1
' Wait for the starting confirmation of the slot 2.
:
Task slot 2. (Program "10")
1 GetM 1
' Get the control of mechanism 1.
2 Servo On
' Turn on the servo of mechanism 1.
3 Mov P1
4 Mvs P2
5 P3=P_Curr
' Substitute P3 in mechanism 1 current position.
6 Servo Off
' Turn mechanism 1 servo OFF.
7 RelM
' Releases the control right of mechanism 1.
8 End
[Explanation]
(1) Normally (in single task operation), mechanism 1 is obtained in the initial status; it is not necessary to
use the GetM instruction.
(2) Because the control right of the same mechanism cannot be acquired simultaneously by multiple tasks,
the following procedure is required in order to operate the robot by other than slot 1:
First, release control right using the RelM instruction by the slot 1 program. Next, acquire control right
using the GetM instruction by the slot program that operates the robot. An error will be generated if the
GetM instruction is executed again using a slot that has already acquired control right.
(3) The instructions requiring control right include the motor power ON/OFF instruction, the interpolation
instruction, the speed acceleration deceleration specification instruction, and the Tool/Base instruction.
(4) If the argument is omitted from the system status variable requiring the mechanism designation, the cur-
rently acquired mechanism will be designated.
(5) If the program is stopped, RelM will be executed automatically by the system. When the program is
restarted, GetM will be executed automatically.
(6) This instruction cannot be used in a constantly executed program.
[Related instructions]
GetM[]<Mechanism No.>