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

Change time limit for RS232

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



Joined: 21 Aug 2007
Posts: 6

View user's profile Send private message

Change time limit for RS232
PostPosted: Tue Oct 23, 2007 5:39 am     Reply with quote

Hello,
I'm using the pic18f4455 with module ethernet tibbo em202, but i need communication adapt to the current state of the network.
How i can change the timeout the RS232 when my PIC work's?

Thanks
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Oct 23, 2007 6:27 am     Reply with quote

Sorry, I don't understand your question. RS232 describes the hardware connection, it is not a protocol and knows nothing about time-outs.
Tuga



Joined: 21 Aug 2007
Posts: 6

View user's profile Send private message

PostPosted: Tue Oct 23, 2007 6:55 am     Reply with quote

The timeout is specified in the #use rs232 statement as shown below. I use this code to define the time limit to receive data in rs232 (50ms to wait):

Code:

#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7, ERRORS, TIMEOUT=50)
void putnet( char c )
{
   putc(c);
}

char getnet()
{
   return(getc());
}


However I do not know change this time with the PIC in operation, but would like to have access to this variable.
It's possible change this variable with the PIC in operation?

Thanks
Ttelmah
Guest







PostPosted: Tue Oct 23, 2007 8:47 am     Reply with quote

Simple answer, don't use the timeout in the #use RS232, but do a search for 'timed_getc'. Since this function then comes under your control, you can change the timeout as you want.
You can change the timing, by having multiple streams with different timeouts defined, but is is bulkier and less flexible than going DIY.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Oct 23, 2007 8:49 am     Reply with quote

See ex_tgetc.c in the examples directory of the CCS compiler for how you can write your own time out version of getc. You could modify this example to accept a second parameter specifying the timeout value, or change it into a global variable.
Tuga



Joined: 21 Aug 2007
Posts: 6

View user's profile Send private message

PostPosted: Thu Oct 25, 2007 4:33 am     Reply with quote

Thank you all for your good advise.
I still have to make some progress in the project, when finished, I leave the solution chosen.
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