Hi Kiem
You can get more details about CAN addressing at https://en.wikipedia.org/wiki/CAN_bus
Since you have a 5 bit DIP switch on your board you can only set 5 of the 11 or (extended addressing mode) 18 bits so you will need to define what address range or which masks you use with this. Based on the DIP switch value you can set the rx ID and its mask as appropriate and receive and CAN message addressed to it.
Eg. of setting a unique extended address and starting operation would be something like:
unsigned char ucID = fnReadDIP(); // get 5 bits of ID
ucID |= 0x26c0; // add fixed bits
CANTABLE tCANParameters; // table for passing information to driver
...
tCANParameters.ulRxID = (CAN_EXTENDED_ID | ucID); // our ID (extended)
tCANParameters.ulRxIDMask = CAN_EXTENDED_MASK;
...
CAN_interface_ID0 = fnOpen(TYPE_CAN, FOR_I_O, &tCANParameters); // open interface
Each time a message is received for the ID there is an event called CAN_RX_MSG which is handled by
Length = fnRead(CAN_interface_ID0, ucInputMessage, (GET_CAN_RX_TIME_STAMP | GET_CAN_RX_ID)); // read received CAN message
This places the ID of the transmitter, the message time stamp, plus the message content into the buffer ucInputMessage, which can then be processed accordingly.
You can see this in operation in the video.
Regards
Mark