Shop OBEX P1 Docs P2 Docs Learn Events
Serin and debug out of GPS data — Parallax Forums

Serin and debug out of GPS data

StuartttttStuarttttt Posts: 45
edited 2006-07-20 17:05 in BASIC Stamp
Hi,
whats the easiest method of recieving a data string with Dec nos, periods, alphanumericals etc (possibly of unknown lengths) and displaying it on the debug screen. (and also having the information such as latittude 5201.1234 available for use) Using a BS2.

ie. gettting and displaying GPS info from various length NMEA messages such as

$GPRMC,185203,A,5201.1234,N,0001.1234,W,0.000,121.7,160496,13.8,E*55

The way I'm using so far seems long winded and cumbersome. ie.

Main:
SERIN 0,188,[noparse][[/noparse]WAIT("RMC"), hr, mn,· sec,· four,· five, six,· seven,· eight,· nine,· ten, eleven,· twelve, thirt, fourt, fift, sixt]· etc
PAUSE 100
DEBUG "GPRMC ", hr," ", mn,"· ",· sec,"· ", four,"· ",· five,"· ",· six,"· ",· seven,"· ",· eight,"· ",· nine,"· ", ten,"· ",· eleven,"· ",· twelve,"· ",thirt,"· ",fourt,"· ", fift,"· ", sixt, CR
PAUSE 100
GOTO Main

Thanks
···· Regards
····· ·Stuart
·

Comments

  • StuartttttStuarttttt Posts: 45
    edited 2006-07-20 09:49
    Well no replies as yet, but I had another read of the manual and may have·answered my own Q. I have ignored the Degs and Mins as unless my new project travels many miles they are irrelevent, and have just captured the Secs by waiting for the correct preceeding Degs/Mins. Below peice of code displays the Latt/Long secs only.

    ' {$STAMP BS2}
    Latt VAR Byte(5)
    Long VAR Byte(5)
    Latt(4)=0
    Long(4)=0
    Main:
    DEBUG HOME
    DEBUG "Lattitude(secs)","···· ",····· "Longitude(secs)",CR
    SERIN 0,188,[noparse][[/noparse]WAIT ("5241."),STR Latt\4]
    SERIN 0,188,[noparse][[/noparse]WAIT ("00112."),STR Long\4]
    DEBUG "·· ",STR Latt,"··············· ", STR Long,CR
    PAUSE 800
    GOTO Main

    But how can STR arrays handle and display a·long (NMEA) string ?· ie, 69 items.·· ·Any takers ?

    Stuart
  • stamptrolstamptrol Posts: 1,731
    edited 2006-07-20 12:14
    The technique I use with GPS is to watch for the leading characters ( $GPRMC ) as you did originally, grab a bunch of characters into an STR array, say, grab(15) then do the processing on the first data. ( In my case, I immediately send them out over an RF link to the data logging laptop sitting on shore ) .

    Then, watch for the leading characters again, except now SKIP the first 15 chars and grab 15 more characters, process, grab some more, etc.

    What most people realize quite quickly is that they don't always need as much data as they think and you can make some decisions as to what data to concentrate on.

    Cheers
  • StuartttttStuarttttt Posts: 45
    edited 2006-07-20 14:50
    Thanks Stamptrol.

    Ah yes, good idea, I'll give that a try. Also good point about only taking the data needed rather than everything available.

    Regards
    Stuart
  • FranklinFranklin Posts: 4,747
    edited 2006-07-20 17:05
    Did a quick search of the forum and found this.www.parallax.com/dl/docs/cols/nv/vol3/col/nv83.pdf·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.