this is what i do for GPS data. (simplified, but this will work). NMEA sentences are ended with a CR, LF, so i loop through the data, checking for a CR, once its received i set a flag and pad with zeros. this gives me a constant length output of the complete NMEA sentence without chopping off any data. There are probably more efficient ways which dont add extra bytes, and the loop takes a bit of time, but at least it works
'record in 70 bytes
SERIN2 GPS_TXA, GBAUD, [wait("$GPGGA"),str GPGGA_IN\80]
'CLEAN UP THE GPGGA Read
CR_BYTE = 0
for i = 0 to 77
if GPGGA_IN[i] = 13 then
CR_BYTE = 1 'set flag that CR has been recorded
GPGGA_IN[i] = 160 'replace CR with a space
endif
if CR_BYTE = 1 then
GPGGA_IN[i] = 160 'pad with zeros
endif
next i
GPGGA_IN[78] = 13
GPGGA_IN[79] = 10
'END CLEAN GPRMC READ
Bookmarks