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:
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 Bit | Description |
---|---|
CO_EMCY_REG_GENERAL | general error (includes all other classes) |
CO_EMCY_REG_CURRENT | error class: current |
CO_EMCY_REG_VOLTAGE | error class: voltage |
CO_EMCY_REG_TEMP | error class: temperature |
CO_EMCY_REG_COM | error class: communication |
CO_EMCY_REG_PROFILE | error class: profile specific error |
CO_EMCY_REG_MANUFACTURER | error 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.
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
.