Mikroelektronika MIKROE-724 データシート
268
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
CANSPISetMask
Prototype
sub procedure CANSPISetMask(dim CANSPI_MASK as byte, dim val as longint, dim
CANSPI_CONFIG_FLAGS as byte)
Description Configures mask for advanced filtering of messages. The parameter
value
is bit-adjusted to the
appropriate mask registers.
Parameters -
CANSPI_MASK
: CAN module mask number. Valid values:
CANSPI_MASK
constants. See CANSPI_
MASK constants.
-
val
: mask register value. This value is bit-adjusted to appropriate buffer mask registers
-
CANSPI_CONFIG_FLAGS
: selects type of message to filter. Valid values:
-
_CANSPI_CONFIG_ALL_VALID_MSG
,
-
_CANSPI_CONFIG_MATCH_MSG_TYPE & _CANSPI_CONFIG_STD_MSG
,
-
_CANSPI_CONFIG_MATCH_MSG_TYPE & _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 mask and message type value
CANSPISetOperationMode(_CANSPI_MODE_CONFIG,0xFF) ‘ set CONFIGURATION
mode (CANSPI1 module must be in config mode for mask settings)
‘ Set all B1 mask bits to 1 (all filtered bits are relevant):
‘ Note that -1 is just a cheaper way to write 0xFFFFFFFF.
‘ Complement will do the trick and fill it up with ones.
CANSPISetMask(_CANSPI_MASK_B1, -1, _CANSPI_CONFIG_MATCH_MSG_TYPE and _
CANSPI_CONFIG_XTD_MSG)
Notes
None.