View previous topic :: View next topic |
Author |
Message |
cchappyboy
Joined: 03 Dec 2008 Posts: 45
|
How to set value for CAN BUS Message acceptance Filter |
Posted: Tue Feb 16, 2010 5:51 pm |
|
|
I use PIC18F458. I want to set different value to RXF0,RXF1 for RXB0 and set values to RXF2, RXF3,RXF4,RxF5 for RXB1. What should I do?
Can I use command
can_associate_filter_to_buffer
(CAN_FILTER_ASSOCIATION_BUFFERS buffer,CAN_FILTER_ASSOCIATION filter);
but it looks only work for ECAN. But pic18F458 is CAN.
Any response I appreciate here in advance. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 16, 2010 6:14 pm |
|
|
Look at the can_init() routine in this CCS driver file:
Quote: | c:\program files\picc\drivers\can-18xxx8.c |
Look at the calls to the can_set_id() function. These are setting the
acceptance filter masks. The middle parameter is the mask. |
|
|
cchappyboy
Joined: 03 Dec 2008 Posts: 45
|
|
Posted: Wed Feb 17, 2010 5:11 pm |
|
|
Thanks for your response.
But I still can't make sense for how can I indicate 2 filters and 1 mask for RB0?
Can_set_id(int * add, int32 id, int1 ext);
It looks there is not para for you to indicate which filter or mask to setup for. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 17, 2010 5:26 pm |
|
|
They explain it in the comments of these 3 lines in the can_init() function:
Quote: |
can_set_id(RX0MASK, CAN_MASK_ACCEPT_ALL, CAN_USE_EXTENDED_ID); //set mask 0
can_set_id(RX0FILTER0, 0, CAN_USE_EXTENDED_ID); //set filter 0 of mask 0
can_set_id(RX0FILTER1, 0, CAN_USE_EXTENDED_ID); //set filter 1 of mask 0
|
The mask is CAN_MASK_ACCEPT_ALL, and the filters are 0 and 0. |
|
|
Guest
|
|
Posted: Thu Feb 18, 2010 10:06 am |
|
|
Thank you so much, I got it. |
|
|
|