This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CAN数据提取与合成



各位大侠,小弟使用TM4C129X开发板初学CAN,目前遇到一个CAN0数据提取和合成的问题

 

ExpectID = CAN0RxMessage.ui32MsgID;

For (i=0; i <CAN0RxMessage.ui32MsgLen; i++)

{

 Data[i] = CAN0RxMessage.pui8MsgMsgData

}

ExpectID是32位,Data一般为8个字节,如何把ExpectIDData连接在一起构成一个Frame呢?

此外,请教TM4C129X的CAN模块的 正常发送和接收模式的模式写法?是直接向下面这样写寄存器为TEST模式吗,LOOPBACK模式我作为发送写法是不是合适呢,接收写法请教各位大神。

HWREG(CAN0_BASE + CAN_O_CTL) = HWREG(CAN0_BASE + CAN_O_CTL) | CAN_CTL_TEST;
HWREG(CAN0_BASE + CAN_O_TST) = HWREG(CAN0_BASE + CAN_O_TST) | CAN_TST_LBACK;