ZD
Joined: 24 Sep 2013 Posts: 16
|
Canbus mask and filters |
Posted: Tue Sep 24, 2013 1:25 am |
|
|
Dear friends,
I'm using dsPIC30F5011. I confused about the filter and masks and how it works. For example, there are messages with ID's 400, 500 and 600 on the bus. And i want to get messages with ID 400 and 500. I want to set Mask0, Filter0 and Filter1 for getting ID 400 and set Mask1, Filter2, Filter3, Filter4, Filter5 for getting ID 500. I wrote the following code. It only gets messages with ID 400. The messages with ID 500 doesn't pass.
Code: | CAN_Init();
can_set_mode(CAN_OP_CONFIG);
can_set_id(&C1RXM0,0x1FFFFFFF,TRUE);
can_set_id(&C1RXF0,0x00000400,TRUE);
can_set_id(&C1RXF1,0x00000400,TRUE);
can_set_id(&C1RXM1,0x1FFFFFFF,TRUE);
can_set_id(&C1RXF2,0x00000500,TRUE);
can_set_id(&C1RXF3,0x00000500,TRUE);
can_set_id(&C1RXF4,0x00000500,TRUE);
can_set_id(&C1RXF5,0x00000500,TRUE);
can_set_mode(CAN_OP_NORMAL); |
Mask1, Filter2, Filter3, Filter4, Filter5 never works. How should i set mask1 and Filter2-5 ?
Thanks in advance.
ZD |
|