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

Rx problem

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



Joined: 09 Mar 2007
Posts: 31

View user's profile Send private message

Rx problem
PostPosted: Mon Jan 21, 2008 3:52 am     Reply with quote

Hi.
as I know PIC receive 8bit character at Rx. But i want PIC receive string from PC. I'm using getc() function to get string input and it's not work. Is there any function could convert or receive string from PC ?
Ttelmah
Guest







PostPosted: Mon Jan 21, 2008 4:25 am     Reply with quote

Built into the language, gets(). In the libraries, in "input.c", get_string().
Now be aware of the 'caveats'. You _must_ have enough space to hold the whole string, _and it's terminating '\0' character_. This is the real 'danger' of gets, in that if you have storage for a 20 character string, and somebody types 21 characters, then the memory buffer will overflow, destroying data. 'get_string', allows you to specify a 'maximum length' to avoid this. There have also been published here, routines to perform a 'timeout' on serial I/O, and the get_string code, can be adapted to use these, to get round the problem of your program being 'hung' waiting for the data to arrive.

Best Wishes
arys



Joined: 09 Mar 2007
Posts: 31

View user's profile Send private message

PostPosted: Wed Jan 23, 2008 10:04 pm     Reply with quote

sorry...
just delete the post. I will not do it again.
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