User manual

mikroC PRO for dsPIC
MikroElektronika
335
ECAN Constants
There is a number of constants predened in the ECAN library. You need to be familiar with them in order to be able to
use the library effectively. Check the example at the end of the chapter.
ECAN_OP_MODE Constants
The ECAN_OP_MODE constants dene ECAN operation mode. The routine ECANxSetOperationMode expect one of
these as their argument:
Copy Code To Clipboard
const unsigned int
_ECAN_MODE_BITS = 0x00E0, // Use this to access opmode bits
_ECAN_MODE_NORMAL = 0x00,
_ECAN_MODE_DISABLE = 0x01,
_ECAN_MODE_LOOP = 0x02,
_ECAN_MODE_LISTEN = 0x03,
_ECAN_MODE_CONFIG = 0x04,
_ECAN_MODE_LISTEN_ALL = 0x07;
ECAN_CONFIG_FLAGS Constants
The ECAN_CONFIG_FLAGS constants dene ags related to the ECAN module conguration. The routines
ECANxInitialize and ECANxSetBaudRate expect one of these (or a bitwise combination) as their argument:
Copy Code To Clipboard
const unsigned int
_ECAN_CONFIG_DEFAULT = 0xFF, // 11111111
_ECAN_CONFIG_PHSEG2_PRG_BIT = 0x01,
_ECAN_CONFIG_PHSEG2_PRG_ON = 0xFF, // XXXXXXX1
_ECAN_CONFIG_PHSEG2_PRG_OFF = 0xFE, // XXXXXXX0
_ECAN_CONFIG_LINE_FILTER_BIT = 0x02,
_ECAN_CONFIG_LINE_FILTER_ON = 0xFF, // XXXXXX1X
_ECAN_CONFIG_LINE_FILTER_OFF = 0xFD, // XXXXXX0X
_ECAN_CONFIG_SAMPLE_BIT = 0x04,
_ECAN_CONFIG_SAMPLE_ONCE = 0xFF, // XXXXX1XX
_ECAN_CONFIG_SAMPLE_THRICE = 0xFB, // XXXXX0XX
_ECAN_CONFIG_MSG_TYPE_BIT = 0x08,
_ECAN_CONFIG_STD_MSG = 0xFF, // XXXX1XXX
_ECAN_CONFIG_XTD_MSG = 0xF7, // XXXX0XXX
_ECAN_CONFIG_MATCH_TYPE_BIT = 0x20,
_ECAN_CONFIG_ALL_VALID_MSG = 0xDF, // XX0XXXXX
_ECAN_CONFIG_MATCH_MSG_TYPE = 0xFF; // XX1XXXXX