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_ex5_simple_receive”,
裡面說到: Message Data Length: "Don't care" for a Receive mailbox,
但我需要知道receive data的DLC, 請問要如何得到?
以下函数可用于使用 IFx 寄存器读取 DLC 字段:
//***************************************************************************** // // CAN_readMessageWithDLC // //***************************************************************************** bool CAN_readMessageWithDLC(uint32_t base, uint32_t objID, uint16_t *msgData, uint16_t *msgLen) { bool status; // // Check the pointers. // ASSERT(msgLen != 0U); // //Read the message first this fills the IF2 registers //with received message for that mailbox // status = CAN_readMessage(base, objID, msgData); // // See if there is new data available. // if(status == true) { *msgLen = (HWREG_BP(base + CAN_O_IF2MCTL) & CAN_IF2MCTL_DLC_M); } return(status); }