![]() |
CANopen Slave Protocol Stack
Version 7.08.00
|
The add-on module CANopen Device Profile CiA 404 allows the integration of measuring devices as specified in CiA 404-1.
The module version is defined by COS_DS404_VERSION_MAJOR and COS_DS404_VERSION_MINOR. Please refer to the history for changes between different versions.
The module is configured by setting of the following symbols inside the cos_conf.h file:
| Define | Description |
| COS_DS404_AI | number of analog input channels |
| COS_DS404_AI_FILTER | support filter for analog inputs |
| COS_DS404_AI_FILTER_MOV_AV | support moving average filter for analog inputs |
| COS_DS404_AI_FILTER_REP_AV | support repeating average filter for analog inputs |
| COS_DS404_AI_SCALING | support scaling for analog inputs |
| COS_DS404_AI_TARE | support tare function for analog inputs (objects x138h, 6139h, x140h) |
| COS_DS404_AO | number of analog output channels |
| COS_DS404_CO | number of controller channels |
| COS_DS404_DI | number of digital input groups (8 lines per group) |
| COS_DS404_DO | number of digital output groups (8 lines per group) |
The profile allows to support different data types. By means of the following symbols one or multiple data types can be selected. The symbols are located inside the cos_conf.h file:
| Define | Description |
| COS_DS404_DT_FLOAT | support data type float, refer to eCO_DT_REAL32 |
| COS_DS404_DT_INT16 | support data type int16_t, refer to eCO_DT_INTEGER16 |
| COS_DS404_DT_INT32 | support data type int32_t, refer to eCO_DT_INTEGER32 |
Use the header file cos404.h to get access to the CANopen Device Profile CiA 404 API.
Each analog input channel is initialized by calling Cos404_AI_DefaultConfiguration() prior to CosMgrStart(). An example initialization routine is located inside the cos404_app_ai.c file.
Analog inputs are read by the application and forwarded to the protocol stack by means of Cos404_AI_SetFieldValue().
If dynamic PDO mapping is supported (COS_PDO_MAPPING > 0) the default mapping can be set inside the CosPdoComSetup() function, as shown in the following example:
Analog outputs are written by the application by means of either Cos404_AO_SetPV_Int16(), Cos404_AO_SetPV_Int32() or Cos404_AO_SetPV_Real32(), depending on the supported data type.
If dynamic PDO mapping is supported (COS_PDO_MAPPING > 0) the default mapping can be set inside the CosPdoComSetup() function, as shown in the following example:
| File | Description |
| cos404.h | CiA 404 - Generic definitions |
| cos404ai.h | CiA 404 - Analog inputs |
| cos404ao.h | CiA 404 - Analog outputs |
| cos404co.h | CiA 404 - Controller function block |
| cos404di.h | CiA 404 - Digital inputs |
| cos404do.h | CiA 404 - Digital outputs |