View previous topic :: View next topic |
Author |
Message |
maxD
Joined: 16 Dec 2013 Posts: 22
|
#int_rda problem |
Posted: Fri Jan 03, 2014 2:49 am |
|
|
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: 1635 Location: Perth, Australia
|
|
Posted: Fri Jan 03, 2014 2:52 am |
|
|
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
|
|
Posted: Fri Jan 03, 2014 2:53 pm |
|
|
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 |
|
|
|