Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section describes the basic node specification. This table must be existent for each CANopen node, which shall be active within the CANopen device.

Example:


Code Block
languagecpp
const CO_NODE_SPEC AppSpec = {
    (CPU_INT08U     ) 0x01,
    (CO_OBJ        *)&AppObjDir,
    (CPU_INT16U     ) sizeof(AppObjDir)/sizeof(CO_OBJ),
    (CO_EMCY_TBL   *)&AppEmcyCode,
    (CO_TMR_MEM    *)&AppTmrMem,
    (CPU_INT16U     ) sizeof(AppTmrMem)/sizeof(CO_TMR_MEM),
    (CANBUS_PARA   *)&AppCanCfg,
    (CPU_INT08U    *)&AppSdoBuf
};


This example specifies the basic node information for the example node. Each entry is a part of this configuration file co_obj_cfg.c. This structure is only required for startup of the CANopen stack.

...

For the usage of this structure, see the Reference Manual [2]. The following example instantiates a single CANopen node:


Code Block
languagecpp
extern const CO_NODE_SPEC AppSpec;
             CO_NODE      AppNode;
 
void StartNode (void)
{
    CONodeInit(&AppNode, (CO_NODE_SPEC  *)&AppSpec);
 
    if (CONodeGetErr(&AppNode) != CO_ERR_NONE) {
 
        /* error handling */
 
    }
};