Page 1 of 1

PostPosted: Thu Jan 11, 2001 12:03 am
by john
I've been playing with the eval version of pocketc. I want to write an interface for my gps receiver but am at a brick wall. The GPS sends an update message on the serial port every second.

How can you tell when the serial recieve buffer is empty? Or full? How can you empty it? I could "read it" empty if I knew how many bytes were there or if I knew when it was empty. Right now if I do a read, then go into a wait loop for 20 seconds or so the next read is 1 second older than the first (GPS message is time stamped in 10msec increments). If I do a 2000 byte garbage read then read again I get older data but I still don't know if there is more data remaining or if I've been wasting time waiting for new data after the buffer was emptied 1000 bytes ago. I'm about to give up!