CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to set value for CAN BUS Message acceptance Filter

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cchappyboy



Joined: 03 Dec 2008
Posts: 45

View user's profile Send private message

How to set value for CAN BUS Message acceptance Filter
PostPosted: Tue Feb 16, 2010 5:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Feb 16, 2010 6:14 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 17, 2010 5:11 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 17, 2010 5:26 pm     Reply with quote

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








PostPosted: Thu Feb 18, 2010 10:06 am     Reply with quote

Thank you so much, I got it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group