Mikroelektronika MIKROE-724 データシート

ページ / 726
312
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
You may use bitwise
 and
 to adjust the appropriate flags. For example:
Copy Code To Clipboard 
init  = _ECAN_CONFIG_SAMPLE_THRICE    and
        _ECAN_CONFIG_PHSEG2_PRG_ON    and
        _ECAN_CONFIG_STD_MSG          and
        _ECAN_CONFIG_MATCH_MSG_TYPE   and
        _ECAN_CONFIG_LINE_FILTER_OFF
...
ECAN1Initialize(1, 1, 3, 3, 1, init)   ‘ initialize ECAN1
ECAN_TX_MSG_FLAGS Constants
ECAN_TX_MSG_FLAGS 
are flags related to transmission of ECAN message. The routine ECANxWrite expect one of 
these (or a bitwise combination) as their argument:
const
    _ECAN_TX_PRIORITY_BITS as word = 0x03
    _ECAN_TX_PRIORITY_0    as word = 0xFC   ‘ XXXXXX00
    _ECAN_TX_PRIORITY_1    as word = 0xFD   ‘ XXXXXX01
    _ECAN_TX_PRIORITY_2    as word = 0xFE   ‘ XXXXXX10
    _ECAN_TX_PRIORITY_3    as word = 0xFF   ‘ XXXXXX11
    _ECAN_TX_FRAME_BIT     as word = 0x08
    _ECAN_TX_STD_FRAME     as word = 0xFF   ‘ XXXXX1XX
    _ECAN_TX_XTD_FRAME     as word = 0xF7   ‘ XXXXX0XX
    _ECAN_TX_RTR_BIT       as word = 0x40
    _ECAN_TX_NO_RTR_FRAME  as word = 0xFF   ‘ X1XXXXXX
    _ECAN_TX_RTR_FRAME     as word = 0xBF   ‘ X0XXXXXX
You may use bitwise 
and
 to extract received message status. For example:
Copy Code To Clipboard 
‘ form value to be used with CANSendMessage: 
send_config  = _ECAN_TX_PRIORITY_0 and
              _ECAN_TX_XTD_FRAME  and
              _ECAN_TX_NO_RTR_FRAME
...
ECAN1SendMessage(id, data, 1, send_config)
ECAN_RX_MSG_FLAGS Constants
ECAN_RX_MSG_FLAGS 
are flags related to reception of ECAN message. If a particular bit is set then corresponding 
meaning is TRUE or else it will be FALSE.