CAN發送函數與CAN接收函數:
voidCAN0SendFrame(CAN_MESSAGEMsg/*,unsignedlongid,unsignedcharlength,unsignedchar*txdata*/)
{
INT8Uindex;/*numberforreadmessage*/
INT8Utbsel;/*symbolforCAN0TBSEL*/
CAN0TBSEL=CAN0T**;/*Selectlowestemptybuffer*/
tbsel=CAN0TBSEL;/*Backupselectedbuffer*/
*((INT32U*)((INT32U)(&CAN0TXIDR0)))=Msg.ulID.ulVal;/*lint!e923MISRA2004Rule11.3castfrompointertounsignedlong*/
if(Msg.ubLen>8U)
{
Msg.ubLen=8U;
}
for(index=0U;index=CAN0_RXBUF_SIZE)
{
g_can0RxBuf.RxInptr=0U;
}
g_can0RxBuf.RxCounter++;
}
}
rte_release_Semaphore(rte_can0_MsgRxSem);
CAN0R**_RXF=1U;/*清中斷標志*/
}
大功率電感廠家 |大電流電感工廠