假设我要把邮箱15的地址通过canUpdateID函数改为66,为什么canTransmit结果都是0?
canUpdateID(canREG1,15,66);
canTransmit(canREG1,15,tempArray1);
如果我不是用canUpdateID而是直接在HAL Code Generator中更改就是可以发送正确的数据,谢谢
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.
Ken,
感谢你的解答。更新ID这个功能已经实现了,单步调试可以看到。原因函数调用的格式不对。但更新后发送还是有问题。比如我设置了两个mailbox,mailbox1和2,然后我用了一个while(1)循环,先发送mailbox1的数据,再发送mailbox2数据,再更新mailbox2的ID,最后再发送mailbox2数据。最后的结果是,我收到的第一帧数据是mailbox1数据,第二帧就是更新ID后的mailbox2数据,更新ID前的mailbox2数据根本没有出来。这是怎么回事呢?
谢谢!
因为你直接写的地址不是邮箱的地址,你还要加上一个值,我已经不记得我当时是怎么算出来的了,但是一个值是0x60000000,另一个是0x40000000,你再看看他的canUpdateID是怎么写的,
@param[in] msgBoxArbitVal (32 bit value):
* Bit 31 - Not used.
* Bit 30 - 0 - The 11-bit ("standard") identifier is used for this message object.
* 1 - The 29-bit ("extended") identifier is used for this message object.
* Bit 29 - 0 - Direction = Receive
* 1 - Direction = Transmit
* Bit 28:0 - Message Identifier.
你看看这,31、30、29都是有值的,剩下的28位才是你的地址