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

#int_rda problem

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



Joined: 16 Dec 2013
Posts: 22

View user's profile Send private message

#int_rda problem
PostPosted: Fri Jan 03, 2014 2:49 am     Reply with quote

Hi guys!
In the ex_sisr.c example , #int_rda written using getc().
But, can we use get_string() instead of getc() inside #int_rda ISR?
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Jan 03, 2014 2:52 am     Reply with quote

Yes. You can do virtually anything you like but it will not do you any good - it will not produce a useful result.

You will receive an interrupt for each character received. Look at examples implementing a serial receive ring buffer.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Jan 03, 2014 2:53 pm     Reply with quote

Quote:

can we use get_string()


i suggest you use a big enough ISR buffer,
and scan it for a \13 , swap it for a \0

then copy the appropriate chars out when your
string terminator is found, making a buffered , virtual get_string();

you could save a lot of looking by comparing each ISR received char to your string term char- and set the flag when it is seen -
if the flag is an INT8
it can be =0 when no str_term has arrived - then
when TRUE make it be equal to the offset in the ISR buffer
WHERE it was seen ( more chars might arrive you know)
-and be very efficient as well
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