The only thing I can think of is that flushrx hasn't flushed all incoming characters. Maybe your machine is too fast This change should make it wait for up to a second for possible incoming data instead of simply returning right away.

static void flushrx()
{
- while(readbyte(0)>=0);
+ while(readbyte(1)>=0);
}
_________________________
40GB - serial #40104051 gpsapp