CANBUS filtering explanation

Hello all, this is my first post here and one of my first programming projects. I am currently using
an arduino uno with a linksprite CANBUS shield (MCP 2515). I’m also using the MCP_CAN_lib-master library.

I am trying to filter a CAN datastream by the message identifier only, and the messages it’s receiving are blank for the final two bytes. I’m trying to wrap my head around the example listed in the library, but get a bit caught up in the different number types (hex, dec, etc.).

The example masks and filters in the setup of the example are:

CAN0.init_Mask(0,0,0x010F0000); // Init first mask…
CAN0.init_Filt(0,0,0x01000000); // Init first filter…
CAN0.init_Filt(1,0,0x01010000); // Init second filter…

CAN0.init_Mask(1,0,0x010F0000); // Init second mask…
CAN0.init_Filt(2,0,0x01030000); // Init third filter…
CAN0.init_Filt(3,0,0x01040000); // Init fouth filter…
CAN0.init_Filt(4,0,0x01060000); // Init fifth filter…
CAN0.init_Filt(5,0,0x01070000); // Init sixth filter…

If say I wanted to just receive messages with the identifiers 605, 606, and 607, regardless of their content or blank bytes, what would the masks/filters look like? And could you please explain this a bit?

Thanks in advance!

Also to clarify, when I say “blank bytes”, in an 8 byte message typically I would expect:

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, for all zeros

however this device outputs:

0x00, 0x00, 0x00, 0x00, 0x00, 0x0

Attached is an image of the device output from a canbus usb dongle, hopefully further clarifying the device output. While I am currently using only identifiers 605 and 606, I will probably require a third message as well.

Step one, convert the arbitration values to binary…

605 --> [url=https://www.google.com/search?q=convert+605+to+binary]0b1001011101[/url]
606 --> [url=https://www.google.com/search?q=convert+606+to+binary]0b1001011110[/url]

Step two, bitwise-or the values to create the mask…

0b1001011101
0b1001011110
------------
0b1001011111

Step three, make the calls…

CAN0.init_Mask( 0, 0, 0b1001011111 );                // Init first mask...
CAN0.init_Filt( 0, 0, 605 );                // Init first filter...
CAN0.init_Filt( 1, 0, 606 );                // Init second filter...

Step four, bask in the glory of success.

All of which can be reduced to this…

CAN0.init_Mask( 0, 0, 605 | 606 );                // Init first mask...
CAN0.init_Filt( 0, 0, 605 );                // Init first filter...
CAN0.init_Filt( 1, 0, 606 );                // Init second filter...

redw123: Hello all, this is my first post here and one of my first programming projects. I am currently using an arduino uno with a linksprite CANBUS shield (MCP 2515). I'm also using the MCP_CAN_lib-master library.

I am trying to filter a CAN datastream by the message identifier only, and the messages it's receiving are blank for the final two bytes. I'm trying to wrap my head around the example listed in the library, but get a bit caught up in the different number types (hex, dec, etc.).

The example masks and filters in the setup of the example are:

CAN0.init_Mask(0,0,0x010F0000); // Init first mask... CAN0.init_Filt(0,0,0x01000000); // Init first filter... CAN0.init_Filt(1,0,0x01010000); // Init second filter...

CAN0.init_Mask(1,0,0x010F0000); // Init second mask... CAN0.init_Filt(2,0,0x01030000); // Init third filter... CAN0.init_Filt(3,0,0x01040000); // Init fouth filter... CAN0.init_Filt(4,0,0x01060000); // Init fifth filter... CAN0.init_Filt(5,0,0x01070000); // Init sixth filter...

If say I wanted to just receive messages with the identifiers 605, 606, and 607, regardless of their content or blank bytes, what would the masks/filters look like? And could you please explain this a bit?

Thanks in advance!

Also to clarify, when I say "blank bytes", in an 8 byte message typically I would expect:

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, for all zeros

however this device outputs:

0x00, 0x00, 0x00, 0x00, 0x00, 0x0

Attached is an image of the device output from a canbus usb dongle, hopefully further clarifying the device output. While I am currently using only identifiers 605 and 606, I will probably require a third message as well.

Can you tell me which software are using to log that output i saw in your attachment screenshot?