Part Number:LAUNCHXL-F280025COther Parts Discussed in Thread:C2000WARE
Hello,
參考了"can_ex5_simple_receive", 實作以下一個簡單的CAN bus receive data,
設定好一個message object後, 只能接收一次data, 想請問是甚麼原因造成的?
#define RX_MSG_OBJ_ID 1
uint16_t rxMsgData[8];
void main(void)
{
Device_init();
Device_initGPIO();
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
CAN_initModule(CANA_BASE);
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1,
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RX, 0,
CAN_MSG_OBJ_FIFO, 0);
CAN_startModule(CANA_BASE);
while(1)
{
if(((HWREGH(CANA_BASE + CAN_O_ES) & CAN_ES_RXOK)) == CAN_ES_RXOK)
{
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
rxMsgCount++;
}
}
Yale Li:
您好,请问您参考的是这个例程吗:can_ex5_transmit_receive
您的C2000ware是什么版本的?
,
Amos Lin:
已解決, 謝謝
,
Yale Li:
好的,不客气