Parameter Objects

The CANopen stack provides service functions, a callback interface and a system object type for managing parameters. The parameters are handled in parameter groups. The parameter group memory must be a consecutive memory area. The recommended way to allocate this memory area is shown in the following example:


struct DEMO_PARA_T {
    CPU_INT32U ParaLong;               /* 32bit demo parameter            */
 } DemoParaMem;


The parameter group object holds all necessary information, which are needed for the parameter handling. Note: this structure may be placed into ROM, because it holds only constant values.


const CO_PARA {
    sizeof(struct DEMO_PARA_T),         /* size of parameter memory        */
    &DemoParaMem,                       /* start address of parameter mem  */
    &DemoParaDef,                       /* start address of default para.  */
    CO_RESET_NODE,                      /* reset type for reload parameter */
    (void*)"DemoParaId",                /* user parameter identification   */
    CO_PARA___E                         /* read value of parameter object  */
 } DemoParaObj;


If this parameter group must be controllable from the CAN network side, the standard parameter save object (and optionally the parameter load object) must be placed into the corresponding place of the object directory:

  (CPU_INT32U)&DemoParaObj       /* pointer to parameter object    */

The parameter values itself can be used within any object directory entry. The following example shows the usage of the first parameter within the parameter group DemoParaMem:

  (CPU_INT32U)&(DemoParaMem.ParaLong)   /* pointer to parameter  */

If a parameter group must be controllable from the node application side, the API function group COPara…() is provided. The following line stores the given parameter group in NVM.

COParaStore(&DemoParaObj, &demo);       /* store parameter group */

The following diagram shows the internal behavior of storing a parameter object:


Figure - Save Parameter Group