User manual
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
311
ECAN Constants
There is a number of constants predened 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 dene ECAN operation mode. The routine ECANxSetOperationMode expect one of
these as their argument:
Copy Code To Clipboard
const
_ECAN_MODE_BITS as word = 0x00E0 ‘ Use this to access opmode bits
_ECAN_MODE_NORMAL as word = 0x00
_ECAN_MODE_DISABLE as word = 0x01
_ECAN_MODE_LOOP as word = 0x02
_ECAN_MODE_LISTEN as word = 0x03
_ECAN_MODE_CONFIG as word = 0x04
_ECAN_MODE_LISTEN_ALL as word = 0x07
ECAN_CONFIG_FLAGS Constants
The ECAN_CONFIG_FLAGS constants dene ags related to the ECAN module conguration. The routines
ECANxInitialize and ECANxSetBaudRate expect one of these (or a bitwise combination) as their argument:
Copy Code To Clipboard
const
_ECAN_CONFIG_DEFAULT as word = 0xFF ‘ 11111111
_ECAN_CONFIG_PHSEG2_PRG_BIT as word = 0x01
_ECAN_CONFIG_PHSEG2_PRG_ON as word = 0xFF ‘ XXXXXXX1
_ECAN_CONFIG_PHSEG2_PRG_OFF as word = 0xFE ‘ XXXXXXX0
_ECAN_CONFIG_LINE_FILTER_BIT as word = 0x02
_ECAN_CONFIG_LINE_FILTER_ON as word = 0xFF ‘ XXXXXX1X
_ECAN_CONFIG_LINE_FILTER_OFF as word = 0xFD ‘ XXXXXX0X
_ECAN_CONFIG_SAMPLE_BIT as word = 0x04
_ECAN_CONFIG_SAMPLE_ONCE as word = 0xFF ‘ XXXXX1XX
_ECAN_CONFIG_SAMPLE_THRICE as word = 0xFB ‘ XXXXX0XX
_ECAN_CONFIG_MSG_TYPE_BIT as word = 0x08
_ECAN_CONFIG_STD_MSG as word = 0xFF ‘ XXXX1XXX
_ECAN_CONFIG_XTD_MSG as word = 0xF7 ‘ XXXX0XXX
_ECAN_CONFIG_MATCH_TYPE_BIT as word = 0x20
_ECAN_CONFIG_ALL_VALID_MSG as word = 0xDF ‘ XX0XXXXX
_ECAN_CONFIG_MATCH_MSG_TYPE as word = 0xFF ‘ XX1XXXXX