Mikroc, Cansetmask, Cansetfilter – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 153

Advertising
background image

MikroElektronika: Development tools - Books - Compilers

145

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Prototype

void

CANSetMask(char CAN_MASK, long value, char CAN_CONFIG_FLAGS);

Description

Function sets mask for advanced filtering of messages. Given value is bit adjusted to
appropriate buffer mask registers.

Parameters:

CAN_MASK

is one of predefined constant values (see CAN constants);

value

is the mask register value;

CAN_CONFIG_FLAGS

selects type of message to filter,

either

CAN_CONFIG_XTD_MSG

or

CAN_CONFIG_STD_MSG

.

Requires

CAN must be in Config mode; otherwise the function will be ignored.

Example

// Set all mask bits to 1, i.e. all filtered bits are relevant:

CANSetMask(CAN_MASK_B1, -1, CAN_CONFIG_XTD_MSG);

/* Note that -1 is just a cheaper way to write 0xFFFFFFFF.

Complement will do the trick and fill it up with ones. */

CANSetMask

Prototype

void

CANSetFilter(char CAN_FILTER, long value,

char

CAN_CONFIG_FLAGS);

Description

Function sets mask for advanced filtering of messages. Given value is bit adjusted to
appropriate buffer mask registers.

Parameters:

CAN_MASK

is one of predefined constant values (see CAN constants);

value

is the filter register value;

CAN_CONFIG_FLAGS

selects type of message to filter,

either

CAN_CONFIG_XTD_MSG

or

CAN_CONFIG_STD_MSG

.

Requires

CAN must be in Config mode; otherwise the function will be ignored.

Example

/* Set id of filter B1_F1 to 3: */

CANSetFilter(CAN_FILTER_B1_F1, 3, CAN_CONFIG_XTD_MSG);

CANSetFilter

Advertising
This manual is related to the following products: