Mikroelektronika MIKROE-742 데이터 시트
CANSPISetFilter
193
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure CANSPISetFilter(CAN_FILTER: byte; val: longint;
CAN_CONFIG_FLAGS: byte);
CAN_CONFIG_FLAGS: byte);
Returns
Nothing.
Description
Configures message filter. The parameter value is bit-adjusted to the appropri-
ate filter registers.
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 function will be
ignored. See CANSPISetOperationMode.
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.
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)
for filter settings)
// Set id of filter B1_F1 to 3:
CANSPISetFilter(CANSPI_FILTER_B1_F1, 3, CANSPI_CONFIG_XTD_MSG);