COObjRdValue
COObjRdValue
Description
This function reads the value of the given object directory entry.
Prototype
CPU_INT16S COObjRdValue(CO_OBJ *obj ,
void *value,
CPU_INT08U width,
CPU_INT08U nodeid);
Parameter | Description |
---|---|
obj | pointer to the CANopen directory entry |
value | pointer to the result memory |
width | width of read value (must be 1, 2 or 4 and reflecting the width of the referenced variable with given parameter pointer: value) |
nodeid | device nodeid (only used in case of node-id dependent value) |
Returned Value
= CO_ERR.NONE
Successful operation
!= CO_ERR.NONE
An error is detected (see section "Error Identification")
Additional Information
The access with this function to an object entry will be done with casting of the object entry values to the requested value width.
Example
The following example gets the value of the hypothetical application specific object entry "[1234:56]" within the object directory of the CANopen node AppNode.
CPU_INT32U value; CO_OBJ *entry; : entry = CODirFind (&(AppNode.Dir), CO_DEV(0x1234,0x56)); err = COObjRdValue (entry, &value, 4, 0); :
Note: The example shows a read access with the knowledge, that the addressed object entry is independent from the CANopen node-ID. To be independent from this knowledge, the API function CONmtGetNodeId()
may be used to get the current node ID.