CoeReadSdoObject
Reads the value of an SDO object through CANopen over EtherCAT (CoE).
Syntax
KsCommandStatus CoeReadSdoObject(
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: reads all subindexes. FALSE: reads a single subindex.
Value: pointer to the buffer that will be filled in with the data of the object.
Length: the length in byte of the value to read.
Return value
Returns the KsCommandStatus structure.
Remarks
Used to check that the drive or any other slave is configured as expected. If the number of bytes you read is more than what is available, the result may vary between drives. For example, the reading request may fail, or the drive may add leading zeros to the value to be read.
Usable EtherCAT states
ecatPreOP, ecatSafeOP, ecatOP
Example
BYTE byteReadValue = 0;
Command = CoeReadSdoObject(0, 0X6061, 0, FALSE, &byteReadValue, 1);
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksapi.h | ksapi.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also