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

GPS

adnadn Posts: 17
edited 2005-09-08 03:07 in BASIC Stamp
Is there a way to save the NMEA data from the GPS and then just read specific values with the BS2 without using the wait or the timeout formatter of the SERIN command or using the serial buffer ic from Protean Logic Inc? Please help

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2005-08-22 16:29
    Hi,

    Where do you want to save the NMEA data?

    If its in the Stamp, you don't have much storage available.
    Each NMEA 'sentence' can be many characters in length.

    If you want to save a bunch of data, just plug into the serial port on the laptop and use
    Hyperterminal and the 'save to file' option. You'll save everything that the GPS puts out.

    Getting the Stamp to read specific values will still require some work with the SERIN formatters
    in order to get the right numbers out of the file.

    Can you give us some more details on what you're trying to do?

    Cheers,

    Tom Sisk
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-22 16:32
    If you have a stock BS2, then you could parse data on the fly or use an external buffer. If you're using a BS2p-family member you can buffer the data to the Scratchpad RAM and deal with it after.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • adnadn Posts: 17
    edited 2005-08-22 19:34
    Thanks for your reply.
    I am using the bs2 to read 10 different sensors with relatively simple code and send the results to the serial port using the debug command. One of the sensors is the GPS and I am using the following to get the data from the GPS:

    SERIN 8, 16884,150,NODATA,[noparse][[/noparse]WAIT("$GPRMC"), SKIP 1, DEC2 hr, DEC2 mn, DEC2 sc,SKIP 2, DEC2 latD, DEC2 latM, DEC2 latF, SKIP 1,lonHemi,SKIP 1, DEC3 lonD, DEC2 lonM, DEC2 lonF, SKIP 1,latHemi,SKIP 1, DEC3 nsVel,Dot, DEC1 ewVel]
    DEBUG "TIME ",DEC2 hr,":",DEC2 mn,":",DEC2 sc,CR
    DEBUG "Latitude ",DEC2 latD,":",DEC2 latM,":",DEC2 latF,lonHemi,CR
    DEBUG "Longitude ",DEC3 lonD,":",DEC2 lonM,":",DEC2 lonF,latHemi,CR
    DEBUG "Speed ",DEC3 nsVel,Dot, DEC1 ewVel,CR

    which works fine... but the problem is that the bs2 even with the 150 timeout formatter slows down a lot and is not very good for real time monitoring. My thinking is that since you have serial data from the GPS if there is a way to get the data from the GPS with some other serial device (memory) and then use the serin command with the bs2 without using the WAIT formatter to get the data from the memory so that the bs2 will continue to the next command as fast as posible. Maybe all this is wrong since I am just an amateur with all these but please help.
    Also please let me know if the sx microcontroller can perform multitasking, receive serial data while continuing to execute other commands and send serial data out. Is it advisable to imigrate the project to the sx family.

    Thank you for your help.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-22 21:50
    The reason for the delay is that $GPRMC is just one of several strings that are transmitted (to see·what I'm talking about, connect your GPS device to a generic terminal program and watch all the stuff that gets spit out)·-- all that data takes time and at 4800 baud you'll only get each string once every two seconds. It's not the BS2's fault.· With GPS the term "real time" takes on different meaning.· When I do GPS projects, I usually use a Garmin device and try to use the text output at 9600 baud.· The text output from Garmin GPS units uses fixed columns so it is far easier to parse on the fly, and the 2x speed increase (plus the lack of other strings) means updates every second.

    Yes, you can create a serial buffer using the SX -- see the Projects section of a MIDI receiver I created that is able to receive data while doing other things.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • adnadn Posts: 17
    edited 2005-08-23 00:03
    The GPS sends the following (when connected)

    $GPRMC,211437,A,3441.65,N,03302.89,E,000.0,,160805,003.3,E*52
    $GPRMB,A,0.74,L,+054,KKKK,3418.45,N,03304.55,E,023.2,176.6,,V*0F
    $GPR00,+054,KKKK,,,,,,,,,,,,*5F
    $GPGLL,3441.65,N,03302.89,E*69
    $PGRMA,44,f,3*30
    $GPXTE,A,A,0.74,L,N*6D
    $GPBWC,211437,3418.45,N,03304.55,E,176.6,T,173.3,M,023.2,N,KKKK*09

    From all this I need to get the speed and maybe the position.
    The gps cannot send text only nmea183, 182 and 180 sentences (this is 183)
    What I would like to do (if possible) is to have some other device (maybe memory module) receive and save the data as is and then retrieve the data from the memory with the basic stamp. Is this possible? This way the basic stamp program will execute at normal speed (fast) and every time it will come to the serin command it will find the data saved so it will not wait for the gps to send the GPRMC...... The data from the gps will not be updated on every cycle of the program but its ok, at least the rest of the data will be.

    Thank you for your help.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-23 00:09
    It's possible, but you're not going to get the data any faster -- you'll just save the work for the external device. I guess you could use another microcontroller to buffer and parse the data for you. You could do that with an SX and program it in SX/B -- you could probably even do it without interrupts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-09-08 03:07
    My Rikaline GPS can be configured to send only desired sentences ($GPxxx) and the update rate for each. (Maybe yours can, too?)

    The $GPGLL has basic position data & time/date; $GPRMC has position, time/date, speed over land, and some other stuff.

    I have it dumping to an LCD, right now, but I need to run it into a Stamp to re-configure·it for the LCD/HD44780's mapping (line 1, line 3, line 2, line 4 -- why did they have to do that?) and proper presentation.
Sign In or Register to comment.