CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
CANopen Device Profile CiA 404

The add-on module CANopen Device Profile CiA 404 allows the integration of measuring devices as specified in CiA 404-1.

Module version

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.

Configuration

The module is configured by setting of the following symbols inside the cos_conf.h file:

COS_DS404_AI

number of analog inputs

COS_DS404_AI_FILTER

support filter for analog inputs inputs

COS_DS404_AI_SCALING

support scaling for analog inputs

COS_DS404_AO

number of analog outputs

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:

COS_DS404_DT_FLOAT

support data type float, refer to CoDT_REAL32

COS_DS404_DT_INT16

support data type int16_t, refer to CoDT_INTEGER16

COS_DS404_DT_INT32

support data type int32_t, refer to CoDT_INTEGER32

Interface to application

Use the header file cos404.h to get access to the CANopen Device Profile CiA 404 API.

#include "cos404.h"
CiA 404 - Device profile for measuring devices and closed-loop controllers .

Analog inputs

Each analog input channel is initialized by calling Cos404_AI_Init() prior to CosMgrStart(). An example initialization routine is located inside the cos404_app_ai.c file.

Analog inputs are read by the application and passed to the protocol stack by means of either Cos404_AI_SetFV_Int16(), Cos404_AI_SetFV_Int32() or Cos404_AI_SetFV_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:

void CosPdoComSetup(void)
{
// .. other code ..
//------------------------------------------------------------------------------------
// TPDO1 - SYNC-driven PDO
//
//------------------------------------------------------------------------------------
// TPDO1 - map object 7130:01h
//
CosPdoTrmMapEnable(0, 0); // disable current mapping for TPDO1
CosPdoTrmMapAdd( 0, 0 ,0x71300110); // add object 6000:01h, length = 16 bit
CosPdoTrmMapEnable(0, 1); // enable current mapping for TPDO1
// .. other code ..
}
CosPdoCom_ts atsTrmPdoComG[]
@ ePDO_TYPE_SYNC_1
Definition cos_pdo.h:160
void CosPdoComSetup(void)
Setup application specific PDO communication parameter.
uint8_t CosPdoTrmMapEnable(uint8_t ubPdoNumberV, uint8_t ubMapNumberV)
uint8_t CosPdoTrmMapAdd(uint8_t ubPdoNumberV, uint8_t ubMapIdxV, uint32_t ulMapEntryV)
uint8_t ubTransType
Definition cos_pdo.h:224

Analog outputs

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:

void CosPdoComSetup(void)
{
// .. other code ..
//------------------------------------------------------------------------------------
// RPDO1 - event-driven PDO, profile specific
//
//------------------------------------------------------------------------------------
// RPDO1 - map object 6200:01h
//
CosPdoRcvMapEnable(0, 0); // disable current mapping for RPDO1
CosPdoRcvMapAdd( 0, 0 ,0x73000110); // add object 7300:01h, length = 16 bit
CosPdoRcvMapEnable(0, 1); // enable current mapping for RPDO1
// .. other code ..}
uint8_t CosPdoRcvMapAdd(uint8_t ubPdoNumberV, uint8_t ubMapIdxV, uint32_t ulMapEntryV)
@ ePDO_TYPE_EVENT_PROFILE
Definition cos_pdo.h:190
CosPdoCom_ts atsRcvPdoComG[]
uint8_t CosPdoRcvMapEnable(uint8_t ubPdoNumberV, uint8_t ubMapNumberV)

CANopen Device Profile CiA 404 files

cos404.h

CiA 404 - Generic definitions

cos404ai.h

CiA 404 - Analog inputs

cos404ao.h

CiA 404 - Analog outputs