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

Unable to read data from CAN bus

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



Joined: 12 Feb 2012
Posts: 1

View user's profile Send private message

Unable to read data from CAN bus
PostPosted: Sun Feb 12, 2012 7:38 pm     Reply with quote

I have a customized board with PIC 18F4580. I am trying to simulate vehicle environment by sending raw CAN data to the board using CANalyser and CAN case from a PC. I need to read the same data from the board and have to do some processing with it. The code is as follows.
Code:

if(can_kbhit()) // wait for a response
{
can_getd(rx_id,receive,rx_len,stat);
for(i=0;i<8;i++)
{ printf(“%i
“,receive[i]);
}
printf(“\n\rwas received with id %Lx\n\r\n\r”,rx_id);
}

Here the problem is that the function can_kbhit() always returns 0. That means the data is not present in the buffer. Can anyone help me on this. I am new to this technology.
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