ABL electronic PIC16 Personal Computer User Manual


 
There is a number of constants predefined in CAN library. To be able to use the
library effectively, you need to be familiar with these. You might want to check
the example at the end of the chapter.
CAN_OP_MODE
CAN_OP_MODE constants define CAN operation mode. Function
CANSetOperationMode expects one of these as its argument:
#define CAN_MODE_BITS 0xE0
// Use it to access mode bits
#define CAN_MODE_NORMAL 0
#define CAN_MODE_SLEEP 0x20
#define CAN_MODE_LOOP 0x40
#define CAN_MODE_LISTEN 0x60
#define CAN_MODE_CONFIG 0x80
CAN_CONFIG_FLAGS
CAN_CONFIG_FLAGS constants define flags related to CAN module configuration.
Functions CANInitialize and CANSetBaudRate expect one of these (or a bitwise
combination) as their argument:
#define CAN_CONFIG_DEFAULT 0xFF
// 11111111
#define CAN_CONFIG_PHSEG2_PRG_BIT 0x01
#define CAN_CONFIG_PHSEG2_PRG_ON 0xFF
// XXXXXXX1
#define CAN_CONFIG_PHSEG2_PRG_OFF 0xFE
// XXXXXXX0
#define CAN_CONFIG_LINE_FILTER_BIT 0x02
#define CAN_CONFIG_LINE_FILTER_ON 0xFF
// XXXXXX1X
#define CAN_CONFIG_LINE_FILTER_OFF 0xFD
// XXXXXX0X
#define CAN_CONFIG_SAMPLE_BIT 0x04
#define CAN_CONFIG_SAMPLE_ONCE 0xFF
// XXXXX1XX
#define CAN_CONFIG_SAMPLE_THRICE 0xFB
// XXXXX0XX
#define CAN_CONFIG_MSG_TYPE_BIT 0x08
#define CAN_CONFIG_STD_MSG 0xFF
// XXXX1XXX
#define CAN_CONFIG_XTD_MSG 0xF7
// XXXX0XXX
// continues..
MikroElektronika:
Development
tools
-
Books
-
Compilers
14 7
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
CAN Constants