I have the following code setup in order to receive only CAN ID 0x601 - 0x606. I think I have the concept understood. Just want more opinions.
Note* Using MCP2515 and the SEEED library.
CAN0.init_Mask(0, 0, 0x0607); // CAN Mask 1 (allow all messages to be checked)
CAN0.init_Mask(1, 0, 0x0607); // CAN Mask 2 (allow all messages to be checked)
CAN0.init_Filt(0, 0, 0x0600); // Only allow CAN ID 0x0600 to the buffer 1
CAN0.init_Filt(1, 0, 0x0601); // Only allow CAN ID 0x0601 to the buffer 1
CAN0.init_Filt(2, 0, 0x0602); // Only allow CAN ID 0x0602 to the buffer 1
CAN0.init_Filt(3, 0, 0x0603); // Only allow CAN ID 0x0603 to the buffer 1
CAN0.init_Filt(4, 0, 0x0604); // Only allow can ID 0x0604 to the buffer 1
CAN0.init_Filt(5, 0, 0x0606); // Only allow can ID 0x0606 to the buffer 1
Maneet:
I have the following code setup in order to receive only CAN ID 0x601 - 0x606. I think I have the concept understood. Just want more opinions.
Note* Using MCP2515 and the SEEED library.
CAN0.init_Mask(0, 0, 0x0607); // CAN Mask 1 (allow all messages to be checked)
CAN0.init_Mask(1, 0, 0x0607); // CAN Mask 2 (allow all messages to be checked)
CAN0.init_Filt(0, 0, 0x0600); // Only allow CAN ID 0x0600 to the buffer 1
CAN0.init_Filt(1, 0, 0x0601); // Only allow CAN ID 0x0601 to the buffer 1
CAN0.init_Filt(2, 0, 0x0602); // Only allow CAN ID 0x0602 to the buffer 1
CAN0.init_Filt(3, 0, 0x0603); // Only allow CAN ID 0x0603 to the buffer 1
CAN0.init_Filt(4, 0, 0x0604); // Only allow can ID 0x0604 to the buffer 1
CAN0.init_Filt(5, 0, 0x0606); // Only allow can ID 0x0606 to the buffer 1
Going to test tomorrow. It's just that today I had the following code, and all the msg's appeared rather than just 0x600.
CAN0.init_Mask(0, 0, 0xFFFF); // CAN Mask 1 (allow all messages to be checked)
CAN0.init_Filt(0, 0, 0x0600); // Only allow CAN ID 0x0600 to the buffer 1
sherzaad:
looks alright based on your requirement.