User manual

mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
269
CANSPISetFilter
Prototype
sub procedure CANSPISetFilter(dim CAN_FILTER as byte, dim val as longint,
dim CANSPI_CONFIG_FLAGS as byte)
Description Congures message lter. The parameter value is bit-adjusted to the appropriate lter registers.
Parameters - CANSPI_FILTER: CAN module lter number. Valid values: CANSPI_FILTER constants. See
CANSPI_FILTER constants.
- val: lter register value. This value is bit-adjusted to appropriate lter registers
- CANSPI_CONFIG_FLAGS: selects type of message to lter. Valid values: _CANSPI_CONFIG_STD_
MSG and _CANSPI_CONFIG_XTD_MSG. See CANSPI_CONFIG_FLAGS constants.
Returns Nothing.
Requires The CANSPI module must be in Cong mode, otherwise the function will be ignored. See
CANSPISetOperationMode.
The CANSPI routines are supported only by MCUs with the SPI module.
MCU has to be properly connected to mikroElektronika’s CANSPI Extra Board or similar hardware.
See connection example at the bottom of this page.
Example
‘ set the appropriate lter value and message type
CANSPI1SetOperationMode(_CANSPI_MODE_CONFIG,0xFF) set CONFIGURATION mode
(CANSPI1 module must be in cong mode for lter settings)
‘ Set id of lter B1_F1 to 3:
CANSPI1SetFilter(_CANSPI_FILTER_B1_F1, 3, _CANSPI_CONFIG_XTD_MSG)
Notes None.