Difference between revisions of "CANopen:CAN SDO READ"

From SoftMC-Wiki
Jump to: navigation, search
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:CANOpen-Functions
+
{{Template:CANopen Functions
  
 
|DESCRIPTION=
 
|DESCRIPTION=
Line 23: Line 23:
  
 
|EXCEPTIONS=
 
|EXCEPTIONS=
* [[CANOpen:Error Codes|Error_Codes]]
+
* [[CANopen:Error Codes|Error_Codes]]
 
|LIMITATIONS=
 
|LIMITATIONS=
 
Signed 8 and 16 bit objects are not properly converted to LONG.<br>
 
Signed 8 and 16 bit objects are not properly converted to LONG.<br>
Line 34: Line 34:
  
 
|SEE ALSO=
 
|SEE ALSO=
* [[CANOpen:CAN SDO READ STRING|CAN_SDO_READ_STRING]]
+
* [[CANopen:CAN SDO READ STRING|CAN_SDO_READ_STRING]]
* [[CANOpen:CAN SDO WRITE STRING|CAN_SDO_WRITE_STRING]]
+
* [[CANopen:CAN SDO WRITE STRING|CAN_SDO_WRITE_STRING]]
* [[CANOpen:CAN SDO READ|CAN_SDO_READ]]
+
* [[CANopen:CAN SDO READ|CAN_SDO_READ]]
* [[CANOpen:CAN SDO READ REAL|CAN_SDO_READ_REAL]]
+
* [[CANopen:CAN SDO READ REAL|CAN_SDO_READ_REAL]]
* [[CANOpen:CAN SDO WRITE|CAN_SDO_WRITE]]
+
* [[CANopen:CAN SDO WRITE|CAN_SDO_WRITE]]
  
  
 
}}
 
}}

Latest revision as of 15:10, 26 August 2014

In order to communicate with a specific slave we use its address and the functions CAN_SDO_READ, CAN_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 CAN_SDO_READ(byval slaveaddres as long, byval index as long, byval subindex as long) as long

Syntax

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

Limitations

Signed 8 and 16 bit objects are not properly converted to LONG.
For example 8-bit negative value, eg. -3, read as 253.
Application shall apply sign extension for negative 8/16 bit objects.

Exceptions

Examples

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

See Also