void CanSendData(void) { DataA=0x11111111; DataB=0x22222222; do { tbs1=CAN1SR&0x04; ts1=CAN1SR&0x20; }while((tbs1==0)||(ts1!=0)); CanSend(DataA,DataB); }
void CanSend(uint32 Data1,uint32 Data2) { CAN1TFI1 = 0<<31|0<<30|8<<16|0x00; CAN1TID1 = nBoxAddr; CAN1TDA1 = Data1; CAN1TDB1 = Data2; CAN1CMR = 1<<5|1; //一直重试,等待发送 } 为什么CanSendData中发送数据会死机(单点状态下在do while 中循环)? |