GPS -- NMEA Input & Parsing
PJAllen
BannedPosts: 5,065
Here's a sample of the NMEA sentence that I'm dealing with:
$GPGLL,3330.6092,N,11200.6777,W,202110.595,A*27
All I want is the stuff in RED.·
I haven't tried it before, but I used STR to capture it all, using SKIPs, and more STRs.· At the end I read it out to a LCD.
I don't know if I'm writing the input with the STR right.· I have the feeling that I can't use it and then re-use it without the pointer being re-set, too.· The resulting output to the LCD basically repeats all three lines.··
My GPS is outputting the $GPGLL sentence once every 5 seconds.· I push the button to initiate the process: it waits to get/receive a "GLL,", then it starts a grab, then it goes to the printout and my LED comes on, I get the printout on the LCD, the LED goes out, and then it goes back to the top for another button push.
The characters that I get back are odd-ball.
Am I taxing the formatting ability of the BS2 at 4800?· Is my use of STR incorrect?· Any constructive criticism?
·
Here is my programme --
Post Edited By Moderator (Chris Savage (Parallax)) : 9/19/2005 12:02:22 AM GMT
$GPGLL,3330.6092,N,11200.6777,W,202110.595,A*27
All I want is the stuff in RED.·
I haven't tried it before, but I used STR to capture it all, using SKIPs, and more STRs.· At the end I read it out to a LCD.
I don't know if I'm writing the input with the STR right.· I have the feeling that I can't use it and then re-use it without the pointer being re-set, too.· The resulting output to the LCD basically repeats all three lines.··
My GPS is outputting the $GPGLL sentence once every 5 seconds.· I push the button to initiate the process: it waits to get/receive a "GLL,", then it starts a grab, then it goes to the printout and my LED comes on, I get the printout on the LCD, the LED goes out, and then it goes back to the top for another button push.
The characters that I get back are odd-ball.
Am I taxing the formatting ability of the BS2 at 4800?· Is my use of STR incorrect?· Any constructive criticism?
·
Here is my programme --
BtnWrk VAR Byte CD VAR Byte (25)'co-ordinate data Prelims: DIRS = $0F 'MSB INs, LSB OUTs OUTL = %10000000 'preset OUTs INH = %00000000 'preset INs; button bit0, Push: BUTTON 8,1,255,20,BtnWrk,1,Rtrv GOTO Push Rtrv: SERIN 9, 188,[noparse][[/noparse]WAIT("GLL,"),STR CD\7] 'ddmm.mm SERIN 9, 188,[noparse][[/noparse]SKIP 3,STR CD\1] 'skip 3&4 decpl,comma; take N SERIN 9, 188,[noparse][[/noparse]SKIP 1,STR CD\8] 'dddmm.mm SERIN 9, 188,[noparse][[/noparse]SKIP 3,STR CD\1] 'skip 3&4 decpl,comma; takeW SERIN 9, 188,[noparse][[/noparse]SKIP 1,STR CD\6] 'skip comma; take hhmmss SERIN 9, 188,[noparse][[/noparse]SKIP 5,STR CD\1] 'skip time decpl, comma; a/v Status Got1: OUTL=%10000001 'LED=ON, gonna printout; serout bit HI for NO NUL SEROUT 7, 188, [noparse][[/noparse]$0c] 'form feed SEROUT 7, 188, [noparse][[/noparse]STR CD\8] 'ddmm.mmN SEROUT 7, 188, [noparse][[/noparse]$0A,$0D] 'LF,CR SEROUT 7, 188, [noparse][[/noparse]STR CD\9] 'dddmm.mmW SEROUT 7, 188, [noparse][[/noparse]$0A,$0D] 'LF,CR SEROUT 7, 188, [noparse][[/noparse]STR CD\7] 'hhmmssA OUTL=%10000000 'LED=OFF, endof printout; serout bit HI for NO NUL GOTO Push
Post Edited By Moderator (Chris Savage (Parallax)) : 9/19/2005 12:02:22 AM GMT
Comments
· ·SERIN GPS, Baud, [noparse][[/noparse]WAIT("GPGLL,"
···················· DEC latD, SKIP 1, DEC latM,
···················· DEC lonD, SKIP 1, DEC lonM, SKIP 1,
···················· DEC2 hrs, DEC2 mins, DEC2 secs,
···················· SKIP 5,·status]
If you do a bit of search you'll find I've posted a bunch of GPS related programs that you can work with.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
····· I found·much the same·-- sure looks good to me:
First, it hit me: I need to call the STRs by different names .· I got a little further·doing that.· Then, YES, as you Reply'd, Jon, I needed to write my capture as one line; that made the Sun to shine.· Now, I'll re-program the GPS to have it·send the sentence every 2 seconds, I think that's as fast as she goes.· I'll·also take out the test button and those instructions --·but I'm keeping the LED.
By the way, I'm using a 4 x 20 LCD from a previous, unrelated, project.· It has an EIA-232 input.·
My BS2 is a "HomeWork Board" and I use a MAX232 driver between its I/O and the LCD and the GPS.