The RMP Motion Controller APIs

◆ ServiceChannelWrite() [4/4]

void ServiceChannelWrite ( int32_t index,
int32_t subIndex,
int32_t byteCount,
int32_t sdoValue,
uint32_t timeoutMilliseconds )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Write a number in the SDO.

Description:
Write a number to the SDO. The index, subIndex, byteCount, and valid numeric values are drive specific. Refer to the drive manual to determine these values.
Parameters
indexThe memory address to write to
subIndexThe sub index to write to
byteCountThe number of bytes to write
sdoValueThe numeric value to write
Remarks
This function is also available in RapidSequencer.

Axis: Homing

// 1. READY DRIVE
axis.OperationModeSet(RSIOperationMode.RSIOperationModeHOMING_MODE); // Mode of Operation set to Homing Mode.
axis.NetworkNode.AKDASCIICommand("DRV.OPMODE 2"); // Sets the drive operation mode (0 - current | 1 = velocity | 2 = position).
axis.NetworkNode.AKDASCIICommand("HOME.AUTOMOVE 0"); // 0 = Disabled | 1 = Homing starts when drive is enabled.
// Make sure you know your motor's position, velocity, and acceleration units before you send any values.
// 2. SET YOUR LIMIT SWITCHES
axis.NetworkNode.AKDASCIICommand("DIN5.MODE 18"); // Sets the digital input modes. - DI5 is now our Positive Limit Switch.
axis.NetworkNode.AKDASCIICommand("DIN5.INV 1"); // Sets the indicated polarity of a digital input mode. - DI5 is now active when Low.
axis.NetworkNode.AKDASCIICommand("DIN6.MODE 19"); // Sets the digital input modes. - DI6 is now our Negative Limit Switch.
axis.NetworkNode.AKDASCIICommand("DIN6.INV 1"); // Sets the indicated polarity of a digital input mode. - DI6 is now active when Low.
// 3. CONFIGURE DRIVE HOMING PARAMETERS
axis.NetworkNode.AKDASCIICommand("HOME.MODE 1"); // Selects the homing method. MODE1 = Find limit input
axis.NetworkNode.AKDASCIICommand("HOME.V 20");
axis.NetworkNode.AKDASCIICommand("HOME.ACC 200");
axis.NetworkNode.AKDASCIICommand("HOME.DEC 200");
axis.NetworkNode.AKDASCIICommand("HOME.DIR 0"); // Sets homing direction (0 = negative | 1 = positive)
axis.NetworkNode.AKDASCIICommand("HOME.P 0");
axis.NetworkNode.AKDASCIICommand("HOME.DIST 0");
axis.NetworkNode.AKDASCIICommand("HOME.MAXDIST 0");
axis.NetworkNode.AKDASCIICommand("HOME.IPEAK");
// 4. READY AXIS
axis.ErrorLimitActionSet(RSIAction.RSIActionNONE); //Set the action to none so we don't get a position error while the drive is in control.
axis.Abort(); // Disable axis.
axis.ClearFaults(); // Clear any faults.
axis.AmpEnableSet(true); // Enable the axis.
System.Threading.Thread.Sleep(100); // Allow time for amp enable
// 5. START HOMING
axis.NetworkNode.AKDASCIICommand("HOME.MOVE"); // Starts a homing procedure; active in opmode 2 (position) only.
Console.WriteLine("HOME.MOVE");
// 6. CHECK IF HOMING IS DONE
UInt16 statusWordValue;
int isHomedvalue = 0;
int axisIndex = axis.NumberGet();
while (isHomedvalue != 1) // When isHomedValue = 1, homing has finished.
{
statusWordValue = axis.NetworkNode.StatusWordGet(axisIndex);
isHomedvalue = statusWordValue >> 12; // Get the 12th bit only. This bit tells us homing is done when it goes HIGH.
}
Console.WriteLine("Axis homed.");
// 7. CLEAN UP
axis.OriginPositionSet(0.0);//Set the origin to 0, otherwise repeated use will not result in Rapidcode reporting 0 at the found home position.
axis.Abort(); // Disable the axis.
axis.OperationModeSet(RSIOperationMode.RSIOperationModeINTERPOLATED_POSITION_MODE); // Mode of Operation Restore
axis.ErrorLimitActionSet(RSIAction.RSIActionABORT);// Restore the position error action to whatever you want it to be.
Parameters
timeoutMillisecondsThe time in ms that the function will wait for a write response before generating a timeout error.
See also
ServiceChannelWrite