mikroC

making it simple...

CANSPISetMask

mikroC - C Compiler for Microchip PIC microcontrollers

Prototype

void CANSPISetMask(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

CANSPI 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:

 

CANSPISetMask(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. */

 

 

CANSPISetFilter

Prototype

void CANSPISetFilter(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

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

 

 

Example

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

 

CANSPISetFilter(CAN_FILTER_B1_F1, 3, CAN_CONFIG_XTD_MSG);

 

 

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

157