Shop OBEX P1 Docs P2 Docs Learn Events
Datalogging with GPS — Parallax Forums

Datalogging with GPS

Casey GrossCasey Gross Posts: 14
edited 2009-11-01 22:30 in BASIC Stamp
I have made the GPS give me my position but so far i have not been able to write those coordinates to the bs2.
example of received coordinates\/ \/ \/ \/

3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W
3251.7702 N 9649.2256 W

I·need the stamp to save these coordinates for later use.
Any help is appreciated.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-10-31 22:28
    Search the forums (using google). There are three projects out there that I can think of off hand that do what you need. I leave it as an exercise to you to find them.

    Reminds me of a quote: "Fortune helps him who is willing to help himself."
  • Casey GrossCasey Gross Posts: 14
    edited 2009-10-31 22:31
    ive been searching for awhile, before this post havent found anything...
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-31 22:44
    The BS2 has limited storage (2K bytes) that is shared with the compiled program. You store data in this EEPROM storage using the WRITE statement. There are examples of this statement and how to store data in the EEPROM using it in the Stamp Manual and in the help files of the Stamp Editor. You've got about 25 bytes per GPS reading. Assuming your program takes about 1/2 the memory, that leaves about 1K bytes which would hold 40 sets of coordinates.

    25 bytes is about all the variable storage that a BS2 has. Where are you storing the data in the Stamp?
  • Casey GrossCasey Gross Posts: 14
    edited 2009-11-01 21:14
    This is the code I have, Im try to have it write just one coordinate and read it. I get these coordinates back: 1 79.0022 N.
    but the coordinates the gps gives me are: 32 51.7702 N. Why is it storing the wrong coordinates?


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    gpstime VAR Word
    N VAR Word
    W VAR Word
    NN VAR Word
    WW VAR Word
    speed1 VAR Word
    speed2 VAR Nib
    course1 VAR Word
    course2 VAR Nib
    address VAR Word
    n4800 CON 16572

    main:
    SERIN 15,n4800,[noparse][[/noparse]WAIT("RMC,"),DEC gpstime, SKIP 3, DEC N, DEC NN, SKIP 3, DEC W, DEC WW, SKIP 3, DEC speed1, DEC speed2, DEC course1,DEC course2]
    WRITE 0, N, NN
    READ 0, N, NN
    DEBUG DEC N/100," ",DEC N//100,".", DEC4 NN," N "
  • SRLMSRLM Posts: 5,045
    edited 2009-11-01 22:24
    You aren't accounting for the 16 bit max variable size. The highest unsigned value that you can store is 65535. So for one it will overflow on GPS time, which may screw things up further down the chain. You have the potential to be doing something similar for DEC w. Finally, READ and WRITE are byte sized commands. If you want to use words with them then you have to specifically say so.

    One last comment. Your code will be much easier to read if you choose meaningful variable names, instead of one or two letters.
  • Casey GrossCasey Gross Posts: 14
    edited 2009-11-01 22:30
    Thanks SRLM, I know what to do now
Sign In or Register to comment.