Quote Originally Posted by orlandoG View Post
Hello...Can someone help me out I am using an example I found here: http://www.melabs.com/resources/samples/18F/serA452.bas
I want to be able to send commands from a PC such as ADR,GET\r and ADR,SET,100\r etc. I just can't figure out how to decode the incoming data.
The HSERIN command works but its too slow for my application and it hangs up if I try to send multiple commands at the same time.
The following code works...but not all the time. It seems to miss (i'm assumming the index_out has something to do with it) I don't know assembly language but is there a way to modify the asm routine to read up to a terminating char such as a CR or LF and clear the buffer?
I'm using an 18F6722 running a 40MHz xtal
Guaranteed that a '6722 running at 40mhz can surely handle 9600 baud, whether you're using SERIN2/OUT2 or HSERIN/OUT. It's a matter of setting up your timeout values, and getting your program's flow set up correctly so it doesn't look like it's hanging up anywhere.

As far as reading up to a CR/LF, check your little green manual. You can receive X characters optionally terminating in a specific character using those same serial commands.