ID : 7707
Sample Program
This section shows a sample program for the robot control with Command-Slave function.
The following steps shows how to create a sample program that moves the 6-axis robot from the start position to the target position with PTP control, absolute position movement.
1
Prepare variables for Command-Slave.
In the [GVLs] folder, in the global variable lists, create "eRC_AxesGroup" type and "eRC_PosDensoRobot" type variables.
In this example, variables are declared in array. Select any declaration method as you like.
2
In the [POUs] folder, create [(MAIN)main program], [(PositionData)position data program] and [(RobCtrl)robot control program].
In this example, main program and robot control program are created by LD (Ladder Diagram), and position data program is created by ST (Structures Text). Select any programming language.
3
First, create a main program.
Place "MC_ReadAxesGroup" on the top of the program.
4
Place "MC_Initialize".
5
Place "MC_Reset" in case of error.
Assign any global variable in the input parameter "Execute".
Place "MC_Power" just before "MC_Reset" to turn the robot motor on.
Assign any global variable in the input parameter "Enable".
Also, as the following figure shows, create a program so that the input variable "Execute" of "MC_Reset" is reset when "MC_Reset" has been completed.
At the same time, create a program so that the input variable "Enable" of "MC_Power" reset when an error occurs.
6
To specify the start position and the target position of robot, allocate a position data program.
The details about a position data program is described in STEP9.
7
To specify the details of robot control, allocate a robot control program.
The details about a robot control program is described in STEP10.
8
Place "MC_WriteAxesGroup" in the end of the program.
9
Next, create a position data program.
Declare the start position and the target position.
In this example, "Position[10]" is declared as a start position and "Position[11]" is declared as a target position.
10
Lastly, create a robot control program.
Place "MC_MoveAxisAbsolute" to move the robot to the start position.
For the input variable "Execute", specify any global variable.
For input variable "AxisPosition", specify the start position that has been specified in STEP9.
11
Place "MC_MoveAxisAbsolute" to move the robot to the target position.
For input variable "Execute", specify any global variable.
For input variable "AxisPosition", specify the target position that has been specified in STEP9.
As the following shows, specifying the output variable "NextActionPermit" to the next FB's input variable "Execute" will enables a robot to move these FBs in sequence.
This completes the programming.
ID : 7707