Using the Object Directory
The main application interface within the CANopen network is the object directory of the CANopen nodes. The object directory of a node is accessible from the network as well as from the node application.
The definition of the object directory table is possible with a template based code generation environment called "CANopen Config". The generated source files are human readable and well commented automatically. A small example is shown below:
const CO_OBJ DemoObjDir[] = { { CO_KEY(0x1001, 0, CO_UNSIGNED8 |CO_OBJ___PR_), 0, (CPU_INT32U)&DemoErrReg }, { CO_KEY(0x1005, 0, CO_UNSIGNED32|CO_OBJ_D__R_), 0, (CPU_INT32U) 0x00000080 }, { CO_KEY(0x1014, 0, CO_UNSIGNED32|CO_OBJ__N_R_), 0, (CPU_INT32U)&DemoEmcyId }, { CO_KEY(0x2500, 0, CO_UNSIGNED32|CO_OBJ____RW), 0, (CPU_INT32U)&DemoVarLong }, : CO_OBJ_DIR_ENDMARK };
Note: The object directory can manage different data types with different properties. This information is encoded within the CO_KEY()
and is described in detail in the configuration sections.
The update of the provided basic and system object types within the object directory is managed by the CANopen stack. The application may read or write these objects at any time. For accessing the object directory the service function groups CODir…()
and COObj…()
are provided.