TI中文支持网
TI专业的中文技术问题搜集分享网站

LAUNCHXL-F280025C: 關於CAN bus receive data的DLC

Part Number:LAUNCHXL-F280025C

我參考範例”can_ex5_simple_receive”, 

裡面說到: Message Data Length: "Don't care" for a Receive mailbox,

但我需要知道receive data的DLC, 請問要如何得到?

Yale Li:

您好,我已向资深工程师寻求帮助。有了结果我会第一时间回复。

,

Yale Li:

以下函数可用于使用 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);
}

赞(0)
未经允许不得转载:TI中文支持网 » LAUNCHXL-F280025C: 關於CAN bus receive data的DLC
分享到: 更多 (0)