各位朋友看看,给我一些参考意见,谢谢了。
//CAN过滤器配置使用库函数stm8s_can.c
/*
*目的:CAN总线中全部为扩展帧,29位ID标志符,想对ID进行过滤,只过滤29位ID的第0到8位,其它位不关心,
*如:接收第0~9位为0和0x02的报文,其它全部丢弃,应如何设置
*/
CAN_FilterNumber = 0;
CAN_FilterActivation = ENABLE;
CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterScale = CAN_FilterScale_32Bit;
CAN_FilterID1=0;
CAN_FilterID2=0;
CAN_FilterID3=0;
CAN_FilterID4=0x0;
CAN_FilterIDMask1=0;
CAN_FilterIDMask2=0;
CAN_FilterIDMask3=0;
CAN_FilterIDMask4=0x0;
CAN_FilterInit(CAN_FilterNumber, CAN_FilterActivation, CAN_FilterMode,
CAN_FilterScale,CAN_FilterID1, CAN_FilterID2, CAN_FilterID3,
CAN_FilterID4,CAN_FilterIDMask1, CAN_FilterIDMask2,
CAN_FilterIDMask3, CAN_FilterIDMask4);
CAN_FilterID1和CAN_FilterIDMask1的具体含义是什么?应如何使用? |