This section describes the definition of the Emergency error code table. This table must be in line with the Emergency identifier enumeration (see co_obj_cfg.h).

Example:


const CO_EMCY_TBL AppEmcyCode[CO_EMCY_N] = {
    { CO_EMCY_REG_GENERAL, CO_EMCY_CODE_GEN_ERR  + 0x01 }, /* APP_EMCY_1 */
    { CO_EMCY_REG_CURRENT, CO_EMCY_CODE_CUR_ERR  + 0x01 }, /* APP_EMCY_2 */
    { CO_EMCY_REG_VOLTAGE, CO_EMCY_CODE_VOL_ERR  + 0x01 }, /* APP_EMCY_3 */
    { CO_EMCY_REG_TEMP   , CO_EMCY_CODE_TEMP_ERR + 0x01 }  /* APP_EMCY_4 */
};


This example defines 4 emergency codes within different error register classes (first entry of each line). The emergency codes itself are based on the standard emergency codes (second entry of each line).

The following descriptions explains the details of the table members:

Error Register BitDescription
CO_EMCY_REG_GENERALgeneral error (includes all other classes)
CO_EMCY_REG_CURRENTerror class: current
CO_EMCY_REG_VOLTAGEerror class: voltage
CO_EMCY_REG_TEMPerror class: temperature
CO_EMCY_REG_COMerror class: communication
CO_EMCY_REG_PROFILEerror class: profile specific error
CO_EMCY_REG_MANUFACTURERerror class: manufacturer specific

The EMCY handling and object directory manipulations with these definitions is performed by the CANopen stack without further definitions.

The application is able to register, clear, reset, check and count emergency errors with the provided function API. For details on this API, see Reference Manual [2].

Example:

status = COEmcyGet(&Node.Emcy, APP_EMCY_1);

This example gets the current status of the Emergency error with the given emergency identifier APP_EMCY.1.