Skip to main content

How to Create a Program for Controlling the Axis Group

The following instructions describe how to create a program for controlling an axis group.

Requirement: A project has been created with an axis group, as specified in the How to Create an Axis Group chapter.

The program for controlling an axis group is created in the PLC_PRG POU with CFC as the implementation language.

  1. Open the PLC_PRG program in the editor.

  2. Drag the Box element to the editor.

  3. Map the function block SMC_GroupPower to the box.

  4. Configure the function block according to the following image.

    _sm_img_mc_power.png

    Explanation:

    • The function block activates all drives of the axis group.

    • The output Status indicates successful controller enable.

  5. Create a function block of type MC_GroupEnable.

    This function block transfers control of the linked axes to the AxisGroup axis group.

  6. Connect the Status output of the SMC_GroupPower function block to the Execute input of the MC_GroupEnable function block.

    _sm_img_mc_group_enable.png

    Explanation:

    • When all axis controllers are powered (Status = TRUE), control of the axes is transferred to the axis group.

    • The Done output reports the success of the command.

  7. Insert a MC_MoveDirectAbsolute function block for running the drive.

  8. Connect the Done output of the MC_GroupEnable function block to the Execute input of the MC_MoveDirectAbsolute function block.

  9. Extend the program as follows:

    _sm_img_mc_move_direct_absolute.png

    Explanation:

    • The MC_MoveDirectAbsolute function block commands a PTP motion of the AxisGroup axis group.

    • In the example, the kinematics are moved to the position (X = 10, Y= 20, Z = 30). This value is mapped to the Position input via the SMC_POS_REF structure.

    • The position is specified in the machine coordinate system (MCS). The coordinate system is selected by means of the CoordSystem input.

Starting the program

If the program has been created completely and it can be compiled without errors, then you can transfer it to the controller.

  1. Start the CODESYS Control Win runtime system (CODESYSControlService.exe program in the "...\GatewayPLC" directory).

  2. In the Communication Settings, set the connection path to your controller.

  3. Click OnlineLogin.

  4. Download the project to the controller.

  5. Click Debug → Start.

  6. In the editor, open the AxisGroup object.

    The positions of the axes are displayed.

  7. Click DebugStart.

    The positions of the axes change.