How to listen and decode multiple GPS sentences ?

How can I do to listen to $GPRMC, $GPGSA, $GPGSV at sime time ? I can handle one, but 3 I don’t figure how to…

I have been using the Input S statement to wait for the sentence to come, validate and decode it.

Question is how to receive the 3 sentences and parse it without lose data ?

Looks my code only can handle one sentence (Main loop) using BascomAvr and a MT-128 module :

Thanks in advance : )

Input #2 , S , Noecho

For I = 1 To Len(s)

Q = Mid(s , I , 1)

Letra = Asc(q)

If Q = “,” Then

Commas = Commas + 1

End If

If Q <> “,” Then

If Letra <> 10 Then

If Letra <> 13 Then

Select Case Commas

Case 1 : _header = _header + Q

Case 2 : _time = _time + Q

Case 3 : _fix = _fix + Q

Case 10 : _date = _date + Q

End Select

End If

End If

End If

Next I

you need to capture all the output sentenses the GPS module spits out, then ones it has done that you parse through the data to get the fields you want.

I figure that. I was losing data but now I’m using buffered serial input and being able to listen to every sentence and have time to parse it. I’m running 2 sentences at 5hz rate : )

but now I’m using buffered serial input

Are you doing this in software or did you get a chip to do the work?

Franklin97355,

I’m doing it in software. By now it’s enough for me as the buffered mode for serial uses interrupts and take care of catch the 2 Nmea sentences each 200 milleseconds.

As a info,

Each time I power up the GPS I initialize it by changing the next modes:

from 4,800 to 38,400 baud

from 6 Nmea sentences to only RMC and GGA

from 1 Hz to 5Hz

I know that I can use a battery to keep the settings on GPS, or better yet to write permanently the settings in the GPS (allows for 8 permanent write down) but until the finall version I’ll keep working this way.

I’m using BascomAvr. Configure the serial port as need and then add the next:

Config Serialin1 = Buffered , Size = 150      'I named it "Serialin1"
Enable Interrupts

then listen for the input as usual:

Do 
   Input #2 , S , Noecho  
   _header = Gettoken(s , 44 , 1)  '<--- from Franz Josef Vögel library 
  
   Ss = Right(_header , 6)    'To remove the #10 from the first token only.. 

  Select Case Ss 
   Case "$GPRMC" :  Call Gprmc 
   Case "$GPGGA" :  Call Gpgga 
  End Select 
Loop

The interrupt service will work for you so don’t have to worry and concentrate in doing your math.