COObjWrValue
Description
This function writes a value to the given object directory entry.
Prototype
CPU_INT16S COObjWrValue(CO_OBJ *obj ,
void *value,
CPU_INT08U width,
CPU_INT08U nodeid);
Parameter | Description |
---|---|
obj | pointer to the CANopen directory entry |
value | pointer to the source memory |
width | width of write 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 writes the value 0 to the hypothetical application specific object entry "[1234:56]" within the object directory of the CANopen node AppNode.
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.