saurabh
Joined: 12 Feb 2012 Posts: 1
|
Unable to read data from CAN bus |
Posted: Sun Feb 12, 2012 7:38 pm |
|
|
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. |
|