EtherCAT:EC SDO READ STRING

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

Similar to EC_SDO_READ, this function allows reading STRING values.
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

str_length - This output variable is populated by the function with the string's length

Return Value

String that is read from the slave.

Declaration

public function EC_SDO_READ_STRING(byval slaveaddres as long, byval index as long, byval subindex as long, str_length as long) as string

Syntax

retVal = EC_SDO_READ_STRING(<Slave address>, <SDO index>, <SDO sub-index>, <String's length>)

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

ret_Str = EC_SDO_READ_STRING(module_address, 0x6000, 1, length)

See Also