Mikroelektronika MIKROE-724 データシート

ページ / 726
258
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
CAN_RX_MSG_FLAGS Constants
CAN_RX_MSG_FLAGS
 are flags related to reception of CAN message. If a particular bit is set; corresponding meaning 
is TRUE or else it will be FALSE.
Copy Code To Clipboard 
const
    _CAN_RX_FILTER_BITS  as word = 0x0007   ‘ Use this to access filter bits
    _CAN_RX_FILTER_1     as word = 0x00
    _CAN_RX_FILTER_2     as word = 0x01
    _CAN_RX_FILTER_3     as word = 0x02
    _CAN_RX_FILTER_4     as word = 0x03
    _CAN_RX_FILTER_5     as word = 0x04
    _CAN_RX_FILTER_6     as word = 0x05
    _CAN_RX_OVERFLOW     as word = 0x08  ‘ Set if Overflowed else cleared
    _CAN_RX_INVALID_MSG  as word = 0x10  ‘ Set if invalid else cleared
    _CAN_RX_XTD_FRAME    as word = 0x20  ‘ Set if XTD message else cleared
    _CAN_RX_RTR_FRAME    as word = 0x40  ‘ Set if RTR message else cleared
    _CAN_RX_DBL_BUFFERED  as  word  =  0x80‘  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 _CAN_RX_OVERFLOW) <> 0 then
  ...
  ‘ Receiver overflow has occurred.
  ‘ We have lost our previous message.
end if
CAN_MASK Constants
CAN_MASK
 constants define mask codes. Function CANxSetMask expects one of these as its argument:
Copy Code To Clipboard 
const
    _CAN_MASK_B1 as word = 0
    _CAN_MASK_B2 as word = 1