[求助]关于MC9S12DG128的CAN ID的问题!
- UID
- 344043
- 性别
- 男
|
[求助]关于MC9S12DG128的CAN ID的问题!
我想问问看,为什么发出来的ID跟设定的ID不同啊!!
比如,我要发送的ID是0x18FF80F3,我按照CAN_SEND的demo写了一段程序
void main(void)
{
MSCAN0_Init();
EnableInterrupts;
for(;;)
{
CANTXID[0]=0xF3;
CANTXID[1]=0x81;
CANTXID[2]=0xFF;
CANTXID[3]=0x18
CANDATA[0]=0x00;
CANDATA[1]=0x05;
CANDATA[2]=0x00;
CANDATA[3]=0X33;
CANDATA[4]=0X44;
CANDATA[5]=0xFF;
CANDATA[6]=0xFF;
CANDATA[7]=0xFF;
CAN_Send();
}
}
void CAN_Send(void)
{
CANRXFLAG = 0;
CAN0TBSEL = CAN0TFLG; /*select one available transmit buffer*/
CANSEL = CAN0TBSEL;
CAN0TXIDR0 = CANID[0];
CAN0TXIDR1 = CANID[1]; /*Extended ID*/
CAN0TXIDR2 = CANID[2];
CAN0TXIDR3 = CANID[3];
CAN0TXDSR0 =CANDATA[0];
CAN0TXDSR1 =CANDATA[1];
CAN0TXDSR2 =CANDATA[2];
CAN0TXDSR3 =CANDATA[3];
CAN0TXDSR4 =CANDATA[4];
CAN0TXDSR5 =CANDATA[5];
CAN0TXDSR6 =CANDATA[6];
CAN0TXDSR7 =CANDATA[7];
CAN0TXDLR = 8;
CAN0TXTBPR = 0;
CAN0TFLG = CANSEL;
delay(20);
}
为什么用CAN OE查看,却发现ID根本不是0x18FF81F3!!
|
|
|
|
|
|