使用MCC配置dsPIC33CK256MP508 CAN通信,目前在调用接收函数过程中遇到问题。如下必须要一直搭配while循环使用,将其屏蔽,CAN则无法接收到数据,有谁成功的使用过MCC生成的代码。while (1)
{
Tmr1_Func();
CAN1_OperationModeSet(CAN_CONFIGURATION_MODE);
if(CAN_CONFIGURATION_MODE == CAN1_OperationModeGet())
{
if(CAN_OP_MODE_REQUEST_SUCCESS == CAN1_OperationModeSet(CAN_NORMAL_2_0_MODE))
{
while(1)
{
if(CAN1_ReceivedMessageCountGet() > 0)
{
if(true == CAN1_Receive(&msg))
{
printf("receive successful\n");
CAN_TX();
break;
}
}
}
}
}
}
|