Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
CANSPISetFilter
179
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure CANSPISetFilter(dim CAN_FILTER as bytedim val as
longint, 
dim CAN_CONFIG_FLAGS as byte)
Returns
Nothing.
Description
Configures message filter. The parameter 
value
is bit-adjusted to the appropri-
ate filter registers.
Parameters:
CAN_FILTER
: CANSPI module filter number. Valid values: 
CANSPI_FILTER
constants (see CANSPI constants) 
val
: filter register value 
CAN_CONFIG_FLAGS
: selects type of message to filter. Valid values: 
CANSPI_CONFIG_ALL_VALID_MSG, 
CANSPI_CONFIG_MATCH_MSG_TYPE and CANSPI_CONFIG_STD_MSG, 
CANSPI_CONFIG_MATCH_MSG_TYPE and CANSPI_CONFIG_XTD_MSG. 
(see CANSPI constants) 
Requires
The CANSPI module must be in Config mode, otherwise the sub 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
CANSPISetOperationMode(CANSPI_MODE_CONFIG,0xFF)
' set CONFIGURATION mode (CANSPI module must be in config mode
for filter settings)
' Set id of filter B1_F1 to 3: 
CANSPISetFilter(CANSPI_FILTER_B1_F1, 3, CANSPI_CONFIG_XTD_MSG)