Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Emergency Code Definition

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:


Code Block
languagecpp
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:

  • The error register bit definition [CPU_INT08U] shall be set to one of the following values:
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 emergency error code [CPU_INT16U] shall be set to the application specific error code. This error code should be defined acc. the CANopen specification.

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

...

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