2019-08-20 15:52发布
challenger 发表于 2017-4-29 10:25 #define EXID1 0x4321 #define EXID2 0x1234
最多设置5个标签!
#define EXID1 0x0001
#define EXID2 0x0002
#define EXID3 0x0003
#define EXID4 0x0004
CAN_FilterInitStructure.CAN_FilterNumber=0; //1yÂËÆ÷0
CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdList;
CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit; //32λ
CAN_FilterInitStructure.CAN_FilterIdHigh= ((((u32)EXID1<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF0000)>>16; //òaé¸Ñ¡μÄID¸ßλ
CAN_FilterInitStructure.CAN_FilterIdLow= (((u32)EXID1<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF; //òaé¸Ñ¡μÄIDμíλ
CAN_FilterInitStructure.CAN_FilterMaskIdHigh=((((u32)EXID2<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF0000)>>16; //òaé¸Ñ¡μÄID¸ßλ
CAN_FilterInitStructure.CAN_FilterMaskIdLow= (((u32)EXID2<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF; //òaé¸Ñ¡μÄIDμíλ
CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0 ; //é¸Ñ¡Æ÷±»1Øáaμ½FIFO0
CAN_FilterInitStructure.CAN_FilterActivation=ENABLE; //ê1Äüé¸Ñ¡Æ÷
CAN_FilterInit(&CAN_FilterInitStructure);
CAN_FilterInitStructure.CAN_FilterNumber=1; //1yÂËÆ÷0
CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdList;
CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit; //32λ
CAN_FilterInitStructure.CAN_FilterIdHigh= ((((u32)EXID3<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF0000)>>16; //òaé¸Ñ¡μÄID¸ßλ
CAN_FilterInitStructure.CAN_FilterIdLow= (((u32)EXID3<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF; //òaé¸Ñ¡μÄIDμíλ
CAN_FilterInitStructure.CAN_FilterMaskIdHigh=((((u32)EXID4<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF0000)>>16; //òaé¸Ñ¡μÄID¸ßλ
CAN_FilterInitStructure.CAN_FilterMaskIdLow= (((u32)EXID4<<3)|CAN_ID_EXT|CAN_RTR_DATA)&0xFFFF; //òaé¸Ñ¡μÄIDμíλ
CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0 ; //é¸Ñ¡Æ÷±»1Øáaμ½FIFO0
CAN_FilterInitStructure.CAN_FilterActivation=ENABLE; //ê1Äüé¸Ñ¡Æ÷
CAN_FilterInit(&CAN_FilterInitStructure);
此问题,已经解决,研究好久,在网上找了不少资料。看了原子哥视频,然后再看野火的视频,终于解决了。答案贴在上面了。
一周热门 更多>