Mikroelektronika MIKROE-724 データシート

ページ / 726
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 Configures message filter. The parameter 
value
 is bit-adjusted to the appropriate filter registers.
Parameters 
CANSPI_FILTER
:  CAN  module  filter  number.  Valid  values: 
CANSPI_FILTER
  constants.  See 
CANSPI_FILTER constants. 
val
: filter register value. This value is bit-adjusted to appropriate filter registers 
CANSPI_CONFIG_FLAGS
: selects type of message to filter. 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  Config  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 filter value and message type
CANSPI1SetOperationMode(_CANSPI_MODE_CONFIG,0xFF)  ‘ set CONFIGURATION mode 
(CANSPI1 module must be in config mode for filter settings)
‘ Set id of filter B1_F1 to 3:
 
CANSPI1SetFilter(_CANSPI_FILTER_B1_F1, 3, _CANSPI_CONFIG_XTD_MSG)
Notes
None.