Mikroelektronika MIKROE-724 データシート

ページ / 726
274
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Copy Code To Clipboard 
const
    _CANSPI_RX_FILTER_BITS  as byte = $07   ‘ Use this to access filter bits
    _CANSPI_RX_FILTER_1     as byte = $00
    _CANSPI_RX_FILTER_2     as byte = $01
    _CANSPI_RX_FILTER_3     as byte = $02
    _CANSPI_RX_FILTER_4     as byte = $03
    _CANSPI_RX_FILTER_5     as byte = $04
    _CANSPI_RX_FILTER_6     as byte = $05
    _CANSPI_RX_OVERFLOW     as byte = $08   ‘ Set if Overflowed else cleared
    _CANSPI_RX_INVALID_MSG  as byte = $10   ‘ Set if invalid else cleared
    _CANSPI_RX_XTD_FRAME    as byte = $20   ‘ Set if XTD message else cleared
    _CANSPI_RX_RTR_FRAME    as byte = $40   ‘ Set if RTR message else cleared
    _CANSPI_RX_DBL_BUFFERED as byte = $80   ‘ Set if this message was hardware double-
buffered
You may use bitwise 
and
 to adjust the appropriate flags. For example:
Copy Code To Clipboard 
if (MsgFlag and _CANSPI_RX_OVERFLOW) <> 0 then
  ...
  ‘ Receiver overflow has occurred.
  ‘ We have lost our previous message.
end if
CANSPI_MASK Constants
The 
CANSPI_MASK
 constants define mask codes. Function CANSPISetMask expects one of these as it’s argument:
Copy Code To Clipboard 
const
    _CANSPI_MASK_B1 as byte = 0
    _CANSPI_MASK_B2 as byte = 1
CANSPI_FILTER Constants
The 
CANSPI_FILTER
 constants define filter codes. Functions CANSPISetFilter expects one of these as it’s argument:
Copy Code To Clipboard 
const
    _CANSPI_FILTER_B1_F1 as byte = 0
    _CANSPI_FILTER_B1_F2 as byte = 1
    _CANSPI_FILTER_B2_F1 as byte = 2
    _CANSPI_FILTER_B2_F2 as byte = 3
    _CANSPI_FILTER_B2_F3 as byte = 4
    _CANSPI_FILTER_B2_F4 as byte = 5