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 index of a slave array. When EtherCAT is started, this index has the same value as the SlaveId, which corresponds to the position of the slave in the network. Please note that after EtherCAT is started in the Operational (Op) state, any addition or removal of slaves from the network will change the position of the slaves in the network (SlaveId). Nevertheless, the index of the slave will remain the same. Newly added devices will be added in the back of the slave array. For all slaves after the change, the index and SlaveId will no longer match. This behavior is only available for physical devices; simulated devices are inapplicable. Please refer to the use cases in EnableHotConnect 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
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