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 support@ccsinfo.com

Canbus mask and filters

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



Joined: 24 Sep 2013
Posts: 16

View user's profile Send private message

Canbus mask and filters
PostPosted: Tue Sep 24, 2013 1:25 am     Reply with quote

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
newguy



Joined: 24 Jun 2004
Posts: 1902

View user's profile Send private message

PostPosted: Tue Sep 24, 2013 9:18 am     Reply with quote

Code:

   // mask bit n | filter bit n | message ID bit n | result
   //     0             x               x             accept
   //     1             0               0             accept
   //     1             0               1             reject
   //     1             1               0             reject
   //     1             1               1             accept
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