View previous topic :: View next topic |
Author |
Message |
priesty100
Joined: 16 Oct 2007 Posts: 6 Location: UK
|
RS485 Problem (rs485_get_message) |
Posted: Mon Mar 10, 2008 9:30 am |
|
|
I am having problems using the RS485 routines:
I am communicating with a servo driver which returns status information after every command it receives.
The section of code concerned is as follows:
Code: | sprintf(rs485_tx_buffer,"%s\r",test_array); //coppy the command from test_array to rs485_tx_buffer
length = strlen(rs485_tx_buffer); //count the number of characters in rs485_tx_buffer
rs485_wait_for_bus(TRUE); //wait for RS485 Bus to become open
rs485_send_message(1,length,rs485_tx_buffer); //send message to servo control
if(rs485_get_message(input_array, FALSE)) //read in message from rs485 into input_array
{
for(i=0; i < input_array[1]; ++i) //print contents of input array via RS232
putc(input_array[i+2]);
}
fprintf(PC,"\n\r");
|
The problem is that the rs485_get_message function always returns FALSE. If the wait input to the function is set as TRUE (to wait for a message), the program hangs.
Any thoughts or help would be most appreciated.
Thank you _________________ Sam |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Mar 11, 2008 8:25 am |
|
|
I don't get it.
is rs485_get_message() some sort of standardized function I should already
know about?
Why didn't you post that function? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 11, 2008 8:56 am |
|
|
He doesn't have to post it. It's in this file:
Quote: | c:\Program Files\picc\Drivers\rs485.c |
|
|
|
|