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

RS485 Problem (rs485_get_message)

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



Joined: 16 Oct 2007
Posts: 6
Location: UK

View user's profile Send private message MSN Messenger

RS485 Problem (rs485_get_message)
PostPosted: Mon Mar 10, 2008 9:30 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Tue Mar 11, 2008 8:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 11, 2008 8:56 am     Reply with quote

He doesn't have to post it. It's in this file:
Quote:
c:\Program Files\picc\Drivers\rs485.c
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