EtherCAT:EC SDO READ

From SoftMC-Wiki
Revision as of 12:20, 4 January 2015 by Nigeller (talk | contribs)
Jump to: navigation, search

This function allows reading INTEGER values of sizes 8, 16 and 32 bits.
In order to communicate with a specific slave we use its address and the functions EC_SDO_READ and EC_SDO_WRITE.
To read data from the slave we have to specify a SDO index and a sub-index.
The first sub-index is 0. If only one sub-index exists, we still have to specify 0 (we cannot omit this field).
The read value is returned from the function and can be set to a variable.

Input

Slave address, SDO index, SDO sub-index.

Output

None

Return Value

Value that is read from the slave.

Declaration

public function EC_SDO_READ(byval slaveaddres as long, byval index as long, byval subindex as long) as long

Syntax

retVal = EC_SDO_READ(<Slave address>, <SDO index>, <SDO sub-index>)

Exceptions

EC_SLAVE_ADDRESS_ERROR - "SLAVE ADDRESS ERROR" 20032
EC_SDO_READ_WRITE_ONLY - "SDO READ ERROR: Attempt to read a write-only object" 20060
EC_SDO_READ_SIZE - "SDO READ ERROR: Received an unreasonable amount of data" 20064

Examples

retVal = EC_SDO_READ(2, 0x6041,0) ' Read status word

See Also