This section describes the specification of a parameter groups. The parameter structures are highly application specific and shall be defined within the application header files.
Example:
Code Block | ||
---|---|---|
| ||
typedef struct COM_PARA_MEM_T {
CPU_INT16U Heartbeat_1017_0;
} COM_PARA_MEM;
typedef struct APP_PARA_MEM_T {
CPU_INT32U DemoLong;
CPU_INT16U DemoWord;
CPU_INT08U DemoByte;
} APP_PARA_MEM;
typedef struct ALL_PARA_MEM_T {
COM_PARA_MEM Com;
APP_PARA_MEM App;
} ALL_PARA_MEM; |
This example defines multiple parameter groups:
- one parameter group containing the communication profile parameter (COM_PARA_MEM).
- one parameter group containing the application specific parameter (APP_PARA_MEM).
- The third definition collects the previously defined parameter groups to a single parameter group to allow loading and storage of both parameter groups with a single access (ALL_PARA_MEM).
These structure type definitions are recommended to force the linker to place the corresponding parameter variables in a consecutive memory block. Any other technique to get this result is reasonable, too.
Within the object directory configuration, the parameter group information structures shall be allocated and filled with the corresponding parameter group information settings.
Example:
Code Block | ||
---|---|---|
| ||
static const CO_PARA AllParaObj = {
sizeof(ALL_PARA_MEM),
(CPU_INT08U *)&Para,
(CPU_INT08U *)&ParaDef,
CO_RESET_NODE,
(void*)"all.txt",
CO_PARA___E
};
static const CO_PARA AppParaObj = {
sizeof(APP_PARA_MEM),
(CPU_INT08U *)&Para.App,
(CPU_INT08U *)&ParaDef.App,
CO_RESET_NODE,
(void*)"app.txt",
CO_PARA___E
};
static const CO_PARA ComParaObj = {
sizeof(COM_PARA_MEM),
(CPU_INT08U *)&Para.Com,
(CPU_INT08U *)&ParaDef.Com,
CO_RESET_COM,
(void*)"com.txt",
CO_PARA___E
}; |
The following descriptions explains the details of the table members:
- The parameter group size [CPU_INT32U] shall be set to the number of bytes within the parameter group memory area.
- The start address of the parameter group memory area [CPU_INT08U *] shall be set to the first address of the parameter group memory.
- The reset type [CO_NMT_RESET] shall be set to one of the following values:
Reset Type | Description |
---|---|
CO_RESET_COM | parameter group shall be set to the stored values on communication reset |
CO_RESET_NODE | parameter group shall be set to the stored values on node reset |
- The pointer to the identification [void *] of this parameter group is not used by the CANopen stack. This member is intended to identify the different parameter groups within the application callback functions, related to the parameter handling. Any type of identification may be used for this purpose. In the shown example, an identification string is used.
- The parameter group feature indication [CPU_INT32U], which is returned on a simple object entry read access, shall be set to one of the following values:
Parameter Feature | Description |
---|---|
CO_PARA____ | parameter group is disabled |
CO_PARA___E | parameter group is enabled and will be stored on command |
CO_PARA__A_ | parameter group is enabled and will be stored autonomously |
CO_PARA__AE | parameter group is enabled and will be stored on command and autonomously |
Note: "autonomously" means without CANopen network interaction; e.g. the application is responsible for the storage of these parameter groups.
The object entries, handling the saving and restoring of parameters, shall be set for the example to the following values:
Code Block | ||
---|---|---|
| ||
{ CO_KEY(0x1010, 0, CO_UNSIGNED8 |CO_OBJ_D__R_), 0, 0x03 },
{ CO_KEY(0x1010, 1, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&AppParaObj },
{ CO_KEY(0x1010, 2, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&ComParaObj },
{ CO_KEY(0x1010, 3, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&AppParaObj }, |
Code Block | ||
---|---|---|
| ||
{ CO_KEY(0x1011, 0, CO_UNSIGNED8 |CO_OBJ_D__R_), 0, 0x03 },
{ CO_KEY(0x1011, 1, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&AllParaObj },
{ CO_KEY(0x1011, 2, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&ComParaObj },
{ CO_KEY(0x1011, 3, CO_UNSIGNED32|CO_OBJ____RW), CO_TPARA, (CPU_INT32U)&AppParaObj }, |
The single parameters are most likely used within the object directory. The example definition of a object entry is shown for one parameter:
...