CONmtSetNodeId
Description
This function sets the requested CANopen Node-ID within the NMT module.
Prototype
void CONmtSetNodeId(CO_NMT *nmt, CPU_INT08U nodeId);
Parameter | Description |
---|---|
nmt | reference to NMT structure |
nodeId | the requested NMT node ID |
Returned Value
none
Additional Information
The following errors are detected within this function:
Value | Description |
---|---|
CO_ERR_NMT_MODE | the CANopen device is not in INIT mode |
CO_ERR_BAD_ARG | the given nodeId is invalid (e.g. zero) |
If one of these errors is detected, this function call will change nothing.
Important: After successful operation, the function CONmtReset()
must be called to re-initialize the internal SDO and PDO tables.
Example
The following example shows how to set a dynamically determined node-ID for the CANopen node AppNode:
CO_ERR err; CPU_INT08U id;<br> : id = <code>AppCalculateNodeId()</code>; CONmtSetNodeId (&(AppNode.Nmt), id); err = CONodeGetErr(&AppNode); if (err == CO_ERR_NONE) { /* calculated node-ID is set */ } else { /* error during setting the node-ID */ } :