Add an axis to a group

To add an axis to a group, use AddAxisToGroup. Since an error on an axis affects the whole group, you can use ResetAxis to reset an alarm before you add an axis to a group. The alarm resetting functions are described in Chapter 5: Single-Axis Motion > Reset and power. You can also use ResetGroup to reset a group before you enable it. In this tutorial, we reset a group. For more information about ResetGroup, see Enable a group.

The group must be disabled when you add an axis, and the axis needs to be disabled when it is added to a group.

In GroupConfiguration.cpp, add the following code:

Copy
AddAxisToGroup
VOID AssignAxis(int Group, int Axis, int IndexInGroup)
{
    RtPrintf("Add Axis %d to Group %d.\n\n", Axis, Group);

    //AddAxisToGroup can be used only in the GroupDisabled state.
    /*Each IndexInGroup can be used only once. If you use the same IndexInGroup for two axes,
      an error will occur when you add the third axis to a group.*/
    KsError nRet = AddAxisToGroup(Group, Axis, IndexInGroup);
    if (nRet != errNoError)
        RtPrintf("AddAxisToGroup failed: %x\n\n", nRet);
}