- UID
- 165583
- 性别
- 男
|
我在网上找了一个MSCAN用于标准帧的初始化例程,为什么在改为扩展帧之后就不能用了呢?请问扩展帧的初始化要注意那些啊?而且我发现的ID在读写的时候好像不是很方便,不知道是不是跟FREESCALE单片机大端存储的方式有关。比如说发送时:
CAN0TXIDR+0 = (unsigned char)(msg->id>>24);
CAN0TXIDR+1 = (unsigned char)(msg->id>>16);
CAN0TXIDR+2 = (unsigned char)(msg->id>>8);
CAN0TXIDR+3 = (unsigned char)(msg->id);
接受时:
unsigned long n=0x0;
msg->id = ((can_pt[CANTXIDR+0]|n)<<24) | ((can_pt[CANTXIDR+1]|n)<<16) | ((can_pt[CANTXIDR+2]|n)<<8) | (can_pt[CANTXIDR+0]);
这样两个赋值对吗?
|
|