Difference between revisions of "EtherCAT:EC SDO READ"
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Languages|EtherCAT:EC_SDO_READ}} | ||
{{Template:EtherCAT-Function | {{Template:EtherCAT-Function | ||
|DESCRIPTION= | |DESCRIPTION= | ||
This function allows reading INTEGER values of sizes 8, 16 and 32 bits.<br/> | This function allows reading INTEGER values of sizes 8, 16 and 32 bits.<br/> | ||
− | + | To communicate with a specific slave, use its address and the functions EC_SDO_READ and [[EtherCAT:EC SDO WRITE|EC_SDO_WRITE]].<br/> | |
− | To read data from the slave | + | To read data from the slave you must specify an SDO index and a sub-index.<br/> |
− | The first sub-index is 0. If only one sub-index | + | The first sub-index is 0. If the object has only one sub-index, you must still specify 0 (this field cannot be omitted)<br/> |
The read value is returned from the function and can be set to a variable.<br/> | The read value is returned from the function and can be set to a variable.<br/> | ||
Latest revision as of 15:14, 6 May 2017
Language: | English • 中文(简体) |
---|
This function allows reading INTEGER values of sizes 8, 16 and 32 bits.
To communicate with a specific slave, use its address and the functions EC_SDO_READ and EC_SDO_WRITE.
To read data from the slave you must specify an SDO index and a sub-index.
The first sub-index is 0. If the object has only one sub-index, you must still specify 0 (this field cannot be omitted)
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