' Steve's suggestion
'whole$ = "": byte$ = " "
'DO
' GET #1, , byte$
' whole$ = whole$ + byte$
'LOOP UNTIL byte$ = CHR$10)
'whole$ = LEFT$(whole$, LEN(whole$) - 2)
'But if we GET one byte$ at time we can just separate each element of the sentence now!
'But since the NMEA sentences are a stream of characters with no fixed length how capture the whole sentence ?
'so
'A tipical GPS sentence is like the following serial stream:
'$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A (followed by CR +LF)
'CONST CR = CHR$(13), LF = CHR$(10), Start = CHR$(36), CheckSum = CHR$(42), Comma = CHR$(44)
", LF = "
", Start = "$", CheckSum = "*", Comma = ","
IniT
SearchStartSentence
GettingFields
ShowResults
Sentence = "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A" + CR + LF
Byte = ""
Sentence = ""
PRINT "press a key to elaborate NMEA 0183 sentence..":
SLEEP
Index = Index + 1
WHILE Byte
<> Comma
AND Byte
<> CheckSum
AND Byte
<> CR
StringGPS(Index) = StringGPS(Index) + Byte
Byte = TakeByte$
Byte = TakeByte$ ' read next character after delimitator "," or "*" or CR
Sentence = Sentence + "\" + StringGPS(A)
Byte = TakeByte$
TakeByte$ = Byte