Shop OBEX P1 Docs P2 Docs Learn Events
Long NMEA data strings — Parallax Forums

Long NMEA data strings

StuartttttStuarttttt Posts: 45
edited 2009-07-09 15:10 in BASIC Stamp
Hi,
Whats the simplest and easiest way to retrieve and display long data strings (ie 68 characters) such as a raw GPS NMEA string ?

·········· $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598, *10·

Can the code below be improved to get all the data ?

sData1 VAR Word
Main:
DEBUG HOME
SERIN 12,188,[noparse][[/noparse]WAIT("RMC,"),STR sdata1\29 ]
PAUSE 100
DEBUG " $GPRMC······ ", STR sdata1,CR,CR
GOTO Main

Thanks for any help
Stuart

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-09 11:53
    The code you gave will not work at all because there's not room in memory for all the data. A BS2 Stamp has only 26 bytes of storage for data. Other Stamp models have varying amounts of "scratchpad ram" which can be used for this sort of thing, but not the BS2. Look at the comparison table for different Stamp models on Parallax's website to see the differences.
  • StuartttttStuarttttt Posts: 45
    edited 2009-07-09 12:05
    Hi Mike ,
    Ah I see now. I did play around with 20 to 30 and now I know why.
    How about getting data in packets of 26 using SKIP and then displaying it each time ?

    SERIN 12,188,[noparse][[/noparse]WAIT("RMC,"),SKIP 26,STR sdata\26 ]

    Any thoughts ?
    I suppose the debug/display part would be difficult.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-09 12:26
    Theoretically you could get data in packets, but it might change between readings and, since it's variable length, you'd have problems decoding it. This is part of why Parallax built a microprocessor into their GPS module that can process the raw NMEA strings to extract some of the information and make it available in small pieces to the Stamp.
  • stamptrolstamptrol Posts: 1,731
    edited 2009-07-09 14:15
    It is quite easy to get the long strings by using the SKIP technique you alluded to. I have used it successfully on several projects with Garmin GPS units.

    While true that the data could conceiviably change from reading to reading, two or three quick readings should give usable data.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • StuartttttStuarttttt Posts: 45
    edited 2009-07-09 14:58
    Hi, Yes the code using skip gets 60 charcaters, however is displayed on 3 lines, just have to figure out how to join them all up. Debug has never been easy for me [noparse];)[/noparse] Anyone any pointers ?

    sData1 VAR Word
    Main:
    DEBUG HOME
    SERIN 12,188,[noparse][[/noparse]WAIT("RMC,"),STR sdata1\20 ]
    PAUSE 100
    DEBUG " $GPRMC 1 ", STR sdata1,CR,CR
    SERIN 12,188,[noparse][[/noparse]WAIT("RMC,"),SKIP 20,STR sdata1\20 ]
    PAUSE 100
    DEBUG " $GPRMC 2 ", STR sdata1,CR,CR
    SERIN 12,188,[noparse][[/noparse]WAIT("RMC,"),SKIP 40,STR sdata1\20 ]
    PAUSE 100
    DEBUG " $GPRMC 3 ", STR sdata1,CR,CR
    GOTO Main

    Stuart
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-09 15:04
    You can't combine the 3 pieces in one DEBUG statement, but you could leave out the CRs on all but the last DEBUG statement and all the DEBUG data will be displayed on one line (assuming it all fits in the DEBUG window in one line).

    The CR is the only thing that causes the data to be displayed on separate lines.
  • StuartttttStuarttttt Posts: 45
    edited 2009-07-09 15:10
    Doh,,,,,, yes I have just a look at that Mike after my last post and it has done the trick. I was thinking it would be more difficult than that [noparse]:)[/noparse]
    However I have never seen a good write up on putting data on the Debug screen where you want it though.

    Thanks for your help

    Stuart
Sign In or Register to comment.