Mikroelektronika MIKROE-442 데이터 시트
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
257
_CAN_CONFIG_MATCH_TYPE_BIT as word = 0x20
_CAN_CONFIG_ALL_VALID_MSG as word = 0xDF ‘ XX0XXXXX
_CAN_CONFIG_MATCH_MSG_TYPE as word = 0xFF ‘ XX1XXXXX
You may use bitwise
and
to form config byte out of these values. For example:
Copy Code To Clipboard
init = _CAN_CONFIG_SAMPLE_THRICE and
_CAN_CONFIG_PHSEG2_PRG_ON and
_CAN_CONFIG_STD_MSG and
_CAN_CONFIG_DBL_BUFFER_ON and
_CAN_CONFIG_VALID_XTD_MSG and
_CAN_CONFIG_LINE_FILTER_OFF
...
CAN1Initialize(1, 1, 3, 3, 1, init) ‘ initialize CAN
CAN_TX_MSG_FLAGS Constants
CAN_TX_MSG_FLAGS
are flags related to transmission of a CAN message:
Copy Code To Clipboard
const
_CAN_TX_PRIORITY_BITS as word = 0x03
_CAN_TX_PRIORITY_0 as word = 0xFC ‘ XXXXXX00
_CAN_TX_PRIORITY_1 as word = 0xFD ‘ XXXXXX01
_CAN_TX_PRIORITY_2 as word = 0xFE ‘ XXXXXX10
_CAN_TX_PRIORITY_3 as word = 0xFF ‘ XXXXXX11
_CAN_TX_FRAME_BIT as word = 0x08
_CAN_TX_STD_FRAME as word = 0xFF ‘ XXXXX1XX
_CAN_TX_XTD_FRAME as word = 0xF7 ‘ XXXXX0XX
_CAN_TX_RTR_BIT as word = 0x40
_CAN_TX_NO_RTR_FRAME as word = 0xFF ‘ X1XXXXXX
_CAN_TX_RTR_FRAME as word = 0xBF ‘ X0XXXXXX
You may use bitwise
and
to adjust the appropriate flags. For example:
Copy Code To Clipboard
‘ form value to be used with CANSendMessage:
send_config = _CAN_TX_PRIORITY_0 and
_CAN_TX_XTD_FRAME and
_CAN_TX_NO_RTR_FRAME
...
CANSendMessage(id, data, 1, send_config)