Shop OBEX P1 Docs P2 Docs Learn Events
Trying to import a NMEA string into memory on BS2? — Parallax Forums

Trying to import a NMEA string into memory on BS2?

WarumaWaruma Posts: 21
edited 2009-10-15 12:09 in BASIC Stamp
Hello all,

I'm trying to import a raw GPS NMEA string into the BS2 so I can manipulate the raw data within my program.· But I can't seem to import and store more than about 10 to 15 characters of the GPS string?· Can the Basic Stamp not handle a string of 70+ characters?

Thanks,

Warren

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-14 01:12
    The BS2 has only 26 bytes of variable space. The other Stamp models have varying amounts of "scratchpad ram" which can be used for receiving raw GPS NMEA strings. This storage limitation is part of the reason for having a "smart" GPS receiver that partially decodes the NMEA data.
  • stamptrolstamptrol Posts: 1,731
    edited 2009-10-14 17:33
    Without lots of memory, as Mike pointed out, you may be limited to the length of string you can process at one time.

    However, you can use the WAIT and SKIP parameters of the SERIN command to grab a certain part of the GPS string, process it then skip over the first batch of characters and grab the next goup of 10, process it then skip over the first two groups and grab 10 more, etc.

    This method works because the GPS resends every few seconds and usually isn't physically moving fast enough for the position data to change too much between the 2 or 3 readings you need to take.

    An alternative is a BS2sx with 60+ bytes of scratchpad RAM or BS2px with 100+ bytes in scratchpad plus a couple extra commands for putting serially received data directly into the scatchpapd.

    Cheers,

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

    http://www.siskconsult.com
    ·
  • WarumaWaruma Posts: 21
    edited 2009-10-14 22:53
    Thanks guys!

    So when I tried to import a GPS string of $GPGSA,A,3,19...· Is each of the characters considered 1 byte?· Or is it considered 1 word?· I'm having trouble visualizing how large my data actually is...

    thanks,

    Warren
  • FranklinFranklin Posts: 4,747
    edited 2009-10-14 22:56
    each letter is a byte.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • stamptrolstamptrol Posts: 1,731
    edited 2009-10-15 12:09
    ·· The easiest way to grab gps data is to use the SERIN with the WAIT and Skip as noted above. Use the STR modifier to load the string into an array. The array size will be limited by how much variable space you have available.

    ··· As pointed out, each character will use a byte of the array.

    ··· Once in the array, you can process the data according to whether its a number or ASCII character.

    ·· I've attached a program I used several years ago with a gps controlled farm tractor. Note that it ran in one slot of a BS2sx, its not the whole program but it will show you how to read in the gps data.

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

    http://www.siskconsult.com
Sign In or Register to comment.