Hi,
Like many people i have been trying to get my head around this, and looked at the hundred or so explanations already posted.
I thought i had it figured out, but it seems any message gets through.
My code for testing is quite simple. I just want 2 message ID's to be allowed through, the data is unimportant.
canbusspeed =3 ;
RXid = 0x761
then main code :-
switch (canbusspeed) {
case 1:
CAN0.begin(MCP_STDEXT, CAN_250KBPS, MCP_16MHZ);
break ;
case 2:
CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ);
break;
case 3:
CAN0.begin(MCP_STDEXT, CAN_1000KBPS, MCP_16MHZ);
break; }
CAN0.setMode(MCP_NORMAL);
CAN0.init_Mask( 0, 0, RXid | RXid+1 ); // Init first mask...
CAN0.init_Filt( 0, 0, RXid ); // Init first filter...
CAN0.init_Filt( 1, 0, RXid+1 ); // Init second filter...
I bitwise-or my TXid and its Following ID( +1) to create my mask, so 0x761 and 0x762 as these are the two addresses I would like allowed through.
I then create my first and second filter. However, when testing, any message ID gets through.
Thanks for any pointers on this.