Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
313
const
    _ECAN_RX_FILTER_BITS as word = 0x000F ‘ Use this to access filter bits
    _ECAN_RX_FILTER_0    as word = 0x00   ‘ filter0 match
    _ECAN_RX_FILTER_1    as word = 0x01   ‘ filter1 match
    _ECAN_RX_FILTER_2    as word = 0x02   ‘ ...
    _ECAN_RX_FILTER_3    as word = 0x03
    _ECAN_RX_FILTER_4    as word = 0x04
    _ECAN_RX_FILTER_5    as word = 0x05
    _ECAN_RX_FILTER_6    as word = 0x06
    _ECAN_RX_FILTER_7    as word = 0x07
    _ECAN_RX_FILTER_8    as word = 0x08
    _ECAN_RX_FILTER_9    as word = 0x09
    _ECAN_RX_FILTER_10   as word = 0x0A
    _ECAN_RX_FILTER_11   as word = 0x0B
    _ECAN_RX_FILTER_12   as word = 0x0C
    _ECAN_RX_FILTER_13   as word = 0x0D
    _ECAN_RX_FILTER_14   as word = 0x0E   ‘ ...
    _ECAN_RX_FILTER_15   as word = 0x0F   ‘ filter15 match
    _ECAN_RX_OVERFLOW    as word = 0x10   ‘ Set if Overflowed else cleared
    _ECAN_RX_INVALID_MSG as word = 0x20   ‘ Set if invalid else cleared
    _ECAN_RX_XTD_FRAME   as word = 0x40   ‘ Set if XTD message else cleared
    _ECAN_RX_RTR_FRAME   as word = 0x80   ‘ Set if RTR message else cleared
You may use bitwise 
and
 to extract received message status. For example:
Copy Code To Clipboard 
if (MsgFlag and _ECAN_RX_OVERFLOW <> 0) then
  ...
  ‘ Receiver overflow has occurred.
  ‘ We have lost our previous message.
end if
ECAN_MASK Constants
The 
ECAN_MASK
 constants define mask codes. The routine ECANxSetMask expect one of these as their argument:
Copy Code To Clipboard 
const
    _ECAN_MASK_0 as word = 0
    _ECAN_MASK_1 as word = 1
    _ECAN_MASK_2 as word = 2
ECAN_FILTER Constants
The 
ECAN_FILTER
 constants define filter codes. The routine ECANxSetFilter expect one of these as their argument: