◆ ServiceChannelWrite() [1/4]

virtual void ServiceChannelWrite ( int32_t  index,
int32_t  subIndex,
int32_t  byteCount,
int32_t  sdoValue 
)
pure virtual

Write a number in the SDO.

ℹ This function is avaliable in RapidCode and RapidSequencer

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

HomingWithAKDdrive

// Constants
const int modeOfOpIndex = 0x6060; // Mode of Operation (DS402 Standard)
const int modeOfOpSubindex = 0x0; // Subindex
const int modeOfOpByteSize = 1; // INTEGER8 (1 byte)
const int modeOfOpValueToHOME = 6; // Hex value to determine Mode (6 = Homing mode)
const int modeOfOpValueToDEFAULT = 8; // Hex value to determine Mode (8 = Cyclic synchronous position mode)
// 1. READY DRIVE
axis.NetworkNode.ServiceChannelWrite(modeOfOpIndex, modeOfOpSubindex, modeOfOpByteSize, modeOfOpValueToHOME); // Mode of Operation (Homing Mode = 6)
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; active in opmode 2 (position) only. MODE1 = Find limit input
axis.NetworkNode.AKDASCIICommand("HOME.V 20"); // Sets homing velocity; active in opmode 2 (position) only.
axis.NetworkNode.AKDASCIICommand("HOME.ACC 200"); // Sets homing acceleration; active in opmode 2 (position) only.
axis.NetworkNode.AKDASCIICommand("HOME.DEC 200"); // Sets homing deceleration; active in opmode 2 (position) only.
axis.NetworkNode.AKDASCIICommand("HOME.DIR 0"); // Sets homing direction; active in opmode 2 (position) only. (0 = negative | 1 = positive)
axis.NetworkNode.AKDASCIICommand("HOME.P 0"); // Sets home position; active in opmode 2 (position) only.
axis.NetworkNode.AKDASCIICommand("HOME.DIST 0"); // Sets homing distance; active in opmode 2 (position) only.
axis.NetworkNode.AKDASCIICommand("HOME.MAXDIST 0"); // Sets the maximum distance the motor is allowed to move during the homing routine. (Disabled when value = 0)
axis.NetworkNode.AKDASCIICommand("HOME.IPEAK"); // Sets the current limit during homing procedure to a mechanical stop; active in opmode 2 (position) only.
// 4. READY AXIS
axis.Abort(); // Disable axis.
axis.ClearFaults(); // Clear any faults.
axis.AmpEnableSet(true); // Enable the axis.
System.Threading.Thread.Sleep(1000); // 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;
while (isHomedvalue != 1) // When isHomedValue = 1, homing has finished.
{
statusWordValue = axis.NetworkNode.StatusWordGet(0); // Get the status word value (index 0x6060).
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.Abort(); // Disable the axis.
axis.NetworkNode.ServiceChannelWrite(modeOfOpIndex, modeOfOpSubindex, modeOfOpByteSize, modeOfOpValueToDEFAULT); // Mode of Operation (Homing Mode = 6)