ID : 7923
Sample Program
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 structured type data for array, create variables of "eRC_AxesGroup" type and "eRC_PosDensoRobot" type.
Refer to "Create a structured type data for array and global variable."
In this example, variables are declared in array. Select any declaration method as you like.
2
In the [Logical POUs] folder, create program type [(MAIN)main] and function block type [(PositionData) position data].
In this example, main program is created by LD (Ladder Diagram), position data program is created by ST (Structures Text). Select any programming language.
3
First, create FB of a position data.
Declare the start position and the target position.
In this example, "RobotPosition[1]" is declared as a start position and "RobotPosition[2]" is declared as a target position.
4
Next, create a main program.
Place "MC_ReadAxesGroup" on the top of the program.
5
Place "MC_Initialize".
6
Place "MC_Reset" in case of error.
Assign any global variable in the input parameter "Execute".
Place "MC_Power" just after "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.
7
To specify the start position and the target position of robot, allocate FB of a position data.
8
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.
9
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.
10
Place "MC_WriteAxesGroup" in the end of the program.
This completes the programming.
ID : 7923