I wasn't talking about HSERIN, I was talking about straight up USART usage.
Maybe something like let the USART receive characters, let an interrupt put the received characters into a FIFO buffer.
In your program loop, you check the buffer for a "READY". If you don't have it, you go on, if you have garbage, you get rid of the garbage...but...if you do have "READY", then if you have X data bytes behind that with some sort of qualifying trailer (say "END"), you have a valid data stream, you extract the data, clear the buffer and wait for another string in the buffer like the above ("READYdatadataEND").
All done in the background, no waiting for anything, and the only thing that holds up your program loop is the quick jump into the interrupt subroutine that pulls the data from the receive register and puts it into the buffer string.
Do you know how to do interrupts? If not, this looks like a pretty good project to learn it on... Not mention...loads of help for ya...
Bookmarks