下面是 初始化 程序 CAN_InitTypeDef CAN0Init; CAN0Init.CAN_Mask = CAN_CR_IE| CAN_CR_CCE | CAN_CR_DAR; CAN0Init.CAN_Bitrate = CAN_BITRATE_100K;
// initialize the interrupt controller EIC_IRQChannelConfig(CAN0_IRQChannel, ENABLE); EIC_IRQChannelPriorityConfig(CAN0_IRQChannel, 1); EIC_IRQCmd(ENABLE);
// initialize the CAN at a standard bitrate, interruptsenabled CAN_Init(CAN0, &CAN0Init);
// switch into Loopback+Silent mode (self-test) //CAN_EnterTestMode(CAN0, CAN_TESTR_SILENT);//CAN_TESTR_LBACK );//| 把上面注销了 因为之前是测试模式 // configure the message objects CAN_InvalidateAllMsgObj(CAN0); CAN_SetTxMsgObj(CAN0, CAN0_TX_MSGOBJ, CAN_EXT_ID); CAN_SetRxMsgObj(CAN0, CAN0_RX_MSGOBJ, CAN_EXT_ID, 0, CAN_LAST_EXT_ID, TRUE);
// reception and release are done in the interrupt handler
wait();
GPIO_BitWrite(GPIO4,LD10,Bit_SET);//LED10
// switch back into Normal mode //CAN_LeaveTestMode(CAN0);
// disable interrupts globally //EIC_IRQCmd(DISABLE); }
只是把进入测试模式的语句注销 可是为什么进不了中断 那里还要配置呢 str731 求救 |