RtecatReadModuleSdoObject

RtecatReadModuleSdoObject reads the value of an object from a module through the CoE (CANopen over EtherCAT) SDO method.

Syntax

Copy
RTECAT_COMMAND_STATUS RtecatReadModuleSdoObject(
  [in]    RTECAT_HANDLE Module,
  [in]    WORD ObIndex,
  [in]    BYTE ObSubIndex,
  [in]    BOOL CompleteAccess,
  [out]   BYTE* pValue,
  [in]    ULONG Length,
  [in]    BOOL Priority
);

Parameters

[in] Module

A handle to a module. To retrieve the corresponding handle, use RtecatOpenModuleByIndex or RtecatOpenModuleByLocation.

[in] ObIndex

An object index in the object dictionary.

[in] ObSubIndex

An object subindex in the object dictionary.

[in] CompleteAccess

TRUE to read all subindexes, FALSE to read a single subindex.

[out] pValue

A pointer to the buffer that stores the value of an object from a module.

[in] Length

The length, in bytes, of the value to read.

[in] Priority

TRUE to use a higher priority queue, FALSE otherwise.

Return Values

The function returns an RTECAT_COMMAND_STATUS structure. If an error occurs, field State of the structure is set to ecatCommandError and the error code is stored in field ErrorId (see RTECAT_ERROR for error values). If the function succeeds, ErrorId is set to ecatErrNoError (which is represented by the value 0). If the function fails, it stores a different error value.

Possible return values:

Return value Meaning

ecatErrNoError

The function succeeded.

ecatErrNullParameter

Parameter pValue is NULL.

ecatErrWrongParameter

One of the following conditions occurred:

  • Parameter Module is invalid.
  • The value of parameter Length is either zero (0) or greater than 128.

ecatErrMainDeviceNotReady

The MainDevice is not ready.

ecatErrWrongEnvironment

The SDO buffer is full.

ecatErrFeatureUnavailable

One of the following conditions occurred:

  • The SubDevice doesn't support CoE.
  • The module is a simulated module, which does not support SDO reading and writing.

ecatErrWrongSubDeviceState

The feature can't be used in the current SubDevice state. The mailbox functionality requires at least PreOp state to execute.

Remarks

RtecatReadModuleSdoObject does not support reading from simulated modules.

RtecatReadModuleSdoObject is an asynchronous function that takes time to complete. It allows for background execution and requires you to check its status by calling RtecatGetCommandStatus or wait for it to complete by calling RtecatWaitForCommand.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtecatApi.h

RtecatApi_W64.lib (Windows), RtecatApi.lib (RTSS)

See Also: