CoeWriteSdoObject

Writes the value of an SDO object through CANopen over EtherCAT (CoE). The module table is different for each module and can be obtained in the user manual of the module. This function takes multiple cycles to finish.

Syntax

KsCommandStatus CoeWriteSdoObject(
     int SlaveId,
     int ObIndex,
     int ObSubIndex,
     BOOL CompleteAccess,
     BYTE* Value,
     int Length
);

Parameters

SlaveId: the slave index. This index value is automatically assigned by the KINGSTAR master when the EtherCAT network starts, based on the physical connection order. The first device connected directly to the master is assigned Index 0, followed by Index 1, Index 2, and so on. These indexes remain consistent within the slave array even if devices are added, removed, or reconnected. Please refer to the use cases in HotConnect, Repair, and Restart for more details.

ObIndex: the CANopen index of the object. See your device manual to get the value.

ObSubIndex: the CANopen subindex of the object. See your device manual to get the value.

CompleteAccess: TRUE: writes all subindexes. FALSE: writes a single subindex.

Value: pointer to the buffer containing the data to be written to the object.

Length: the length in byte of the value to write.

Return value

Returns the KsCommandStatus structure.

Remarks

Used to update the drive configuration while the drive is disabled. You should read the drive's manual to learn when and how to use the SDO. If you call this function when the drive is enabled, an error may occur, depending on the response of your drive.

Usable EtherCAT states

ecatPreOP, ecatSafeOP, ecatOP

Example

Copy
BYTE ModeOperation = 0x8;
Command = CoeWriteSdoObject(0, 0X6060, 0, FALSE, &ModeOperation, 1);

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

CoeReadSdoEntryDescription

CoeReadSdoObject

CoeReadSdoObjectDescription

CoeReadSdoODList