...
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:
Code Block | ||
---|---|---|
| ||
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.
...