28335是可以通过同一个邮箱接收不同的ID数据,并根据ID对接收到的数据进行分类的,但280049的ID不知道如何读取?
请问大家,280049的邮箱的ID如何读取?用哪个寄存器?我参考示例,可以用邮箱2通过IF2DATA和IF2DATB收取到数据,但需要根据帧的ID进行数据的区分,是否280049只能用多个不同的邮箱才能实现根据ID进行区分不同的数据吗?
例如 ID为0x 012345678和ID为0x11115678的 二类帧都可以通过邮箱2进行接收,但需要根据帧的高16位进行区分数据的类型,对于280049是否只能通过配置邮箱2接收0x 012345678的帧,再配置一个邮箱3来接收ID为0x11115678的帧实现?
Susan Yang:
Using IF1ARB or IF2ARB is the right approach to read out the CAN message IDs. However to be able to read it out from those registers you need to setup a read transfer from the message RAM into the IF1ARB or IF2ARB register for the message object which you are using. Please see the the section "26.14.1 Message Interface Register Sets 1 and 2" in the TRM for details.
您需要先用CAN_transferMessage命令把数据传到IF寄存器,而后在IF寄存器中IF2ARB中读取
您可以使用CAN过滤功能,可以在CAN_setupMessageObject定义RX消息对象时,设置合适的msgIDMask
//! If filtering is based on message identifier, the value
//! \b CAN_MSG_OBJ_USE_ID_FILTER has to be logically ORed with the \e flag
//! parameter and \b CAN_MSG_OBJ_USE_EXT_FILTER also has to be ORed for
//! message identifier filtering to be based on the extended identifier.
,
q wen:
谢谢!
,
Susan Yang:
不客气,后续有其他问题欢迎随时发帖