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

Filter and mask Can-Messages

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



Joined: 25 Nov 2004
Posts: 30
Location: Germany

View user's profile Send private message

Filter and mask Can-Messages
PostPosted: Tue Mar 29, 2005 8:49 am     Reply with quote

A few weeks ago, I programmed a PIC18F258 with a can-communication. I had many questions to these, but at the end I was successful.

Now the PIC was brought into the system it shall work with and it doesnot work. It is a big system with much traffic on the can. The PIC doesnot receive the messages he needs. Being connected directly to the computer, it works without problems.

I think that too many messages receive and the PIC cannot pick out the important ones. Now I tried to filter and mask the messages, so that it is easier for him to find the necessary ones.

My code for masking and filtering:

Code:

//set mask and filter
   can_set_mode(CAN_OP_CONFIG);
   RXF0SIDH= 0xA0;   //set filter to %101000xxxxx=500+x
   RXF0SIDL= 0xFF;
   RXM0SIDH= 0xFC;   //mask the first 6 bits => 500-519
   RXM0SIDL= 0;
   can_set_mode(CAN_OP_NORMAL);
   RXB0CON = 0x22;    //activate filter 0?


I tried this configuration in my code, but it doesnot change anything.

Can someone please help me and tell me, what is missing or what is wrong? For configure the can generally I use a library. The code shown above is situated in the main-methode, where the variables are initialized.

I thank you for help. Up to then, pom
treanla
Guest







Config mode ?
PostPosted: Wed Mar 30, 2005 5:41 am     Reply with quote

Have you set the CAN module to be in config-mode when you try to change the mask/filter.
Ttelmah
Guest







PostPosted: Wed Mar 30, 2005 5:51 am     Reply with quote

Looks like the first line of the code as posted to me...

can_set_mode(CAN_OP_CONFIG);

As far as it goes, what is being done appears proably 'right'. Something like a bus monitor is really needed to see what is happening...

Best Wishes
treanla
Guest







Need glasses now....
PostPosted: Wed Mar 30, 2005 7:22 am     Reply with quote

Wow....i'm really blind...
Embarassed Embarassed Embarassed
Ttelmah
Guest







PostPosted: Wed Mar 30, 2005 8:24 am     Reply with quote

It happens.
I have the same problem, you read a post, and 'miss' something that is staring you in the face, then reply to what you are seeing, rather than what is there. I think it is called something like 'being human'.... Laughing

The problem is that I don't think his difficulty is actually in what is posted. I'd suspect something 'deeper'. For instance, because of the way the arbitration on CAN works, if every idle gap, is already receiving a packet, then a device with a lower priority will be starved. I have a 'nasty feelin', that the busy bus, may be behaving like this...

Best Wishes
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