Difference between revisions of "EtherCAT:EC SDO READ"
| Line 2: | Line 2: | ||
|DESCRIPTION= | |DESCRIPTION= | ||
| − | This function allows reading INTEGER values of sizes 8, 16 and 32 bits. | + | This function allows reading INTEGER values of sizes 8, 16 and 32 bits.<br/> |
In order to communicate with a specific slave we use its address and the functions EC_SDO_READ and [[EtherCAT:EC SDO WRITE|EC_SDO_WRITE]].<br/> | In order to communicate with a specific slave we use its address and the functions EC_SDO_READ and [[EtherCAT:EC SDO WRITE|EC_SDO_WRITE]].<br/> | ||
To read data from the slave we have to specify a SDO index and a sub-index.<br/> | To read data from the slave we have to specify a SDO index and a sub-index.<br/> | ||
Revision as of 07:47, 23 October 2014
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