Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual
Page 157

CAN_RX_MSG_FLAGS
CAN_RX_MSG_FLAGS
are flags related to reception of CAN message. If a particular
bit is set; corresponding meaning is TRUE or else it will be FALSE.
#define CAN_RX_FILTER_BITS
0x07
// Use it to access filter bits
#define CAN_RX_FILTER_1
0x00
#define CAN_RX_FILTER_2
0x01
#define CAN_RX_FILTER_3
0x02
#define CAN_RX_FILTER_4
0x03
#define CAN_RX_FILTER_5
0x04
#define CAN_RX_FILTER_6
0x05
#define CAN_RX_OVERFLOW
0x08
// Set if Overflowed; else clear
#define CAN_RX_INVALID_MSG
0x10
// Set if invalid; else clear
#define CAN_RX_XTD_FRAME
0x20
// Set if XTD msg; else clear
#define CAN_RX_RTR_FRAME
0x40
// Set if RTR msg; else clear
#define CAN_RX_DBL_BUFFERED 0x80
// Set if msg was
// hardware double-buffered
You may use bitwise AND (
&
) to adjust the appropriate flags. For example:
if
(MsgFlag & CAN_RX_OVERFLOW != 0) {
... // Receiver overflow has occurred; previous message is lost.
}
CAN_MASK
CAN_MASK
constants define mask codes. Function
CANSetMask
expects one of
these as its argument:
#define CAN_MASK_B1 0
#define CAN_MASK_B2 1
CAN_FILTER
CAN_FILTER
constants define filter codes. Function
CANSetFilter
expects one of
these as its argument:
#define CAN_FILTER_B1_F1 0
#define CAN_FILTER_B1_F2 1
#define CAN_FILTER_B2_F1 2
#define CAN_FILTER_B2_F2 3
#define CAN_FILTER_B2_F3 4
#define CAN_FILTER_B2_F4 5
MikroElektronika: Development tools - Books - Compilers
149
page
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...