Shop OBEX P1 Docs P2 Docs Learn Events
GPS VPN1513 Documentation question — Parallax Forums

GPS VPN1513 Documentation question

JohnR2010JohnR2010 Posts: 431
edited 2012-11-09 09:40 in Propeller 1
I have a question about the documentation of the VPN1513 GPS. First a comment. You have to preference each call (in smart mode) with “!GPS”. That needs to be in the documentation someone from Parallax please, please, put it in. Oh and while your at it, the day and month needs to be swapped on page 4. The VPN1513 responds with "Day, Month, Year" and the documentation says "Month, Day, Year"

Now for my question. I could use a little help with the Latitude and Longitude Fractional Minutes format. Here is a snippet of my SPIN code:
gps.str(String("!GPS"))
gps.tx($05) 'Get Latitude
Byte[@gpsLat][4]:=gps.rx 'Degrees
Byte[@gpsLat][3]:=gps.rx 'Minutes
Byte[@gpsLat][2]:=gps.rx 'Fractional Minutes MSB
Byte[@gpsLat][1]:=gps.rx 'Fractional Minutes LSB
Byte[@gpsLat][0]:=gps.rx 'Direction 0=N 1=S

I simply create a 5 byte array "gpsLat" and grab each byte as they come in after I send the "!GPS5 command. At first look the data looks good but my question is what do they mean by "Fractional Minutes"? The numbers i get don't appear to be in floating point format. I would like to understand what format the two byte Fractional Minutes is in. Thanks. Oh I'm not interested in changing the firmware of the VPN1513 I think this is a simple case of incomplete documentation or the lack of understanding on my part I feel like i'm so close.

Comments

  • John AbshierJohn Abshier Posts: 1,116
    edited 2012-11-07 20:30
    GPS location is 30 degrees 15.1234 minutes
    Lat[4] = 30 Lat[3] = 15 Lat[2] = 1 Lat[1] = 234

    John Abshier
  • JohnR2010JohnR2010 Posts: 431
    edited 2012-11-08 11:32
    John, thanks for the reply. You got me pointed in the right direction.
    Here is what i have come up with. From wikipedia: GPS receivers have three common formats for reporting coordinates. They are: DMS (Degrees, Minutes, Seconds), MinDEC (Degrees, Minutes, Decimal Minutes), and DegDec (Decimal Degree). From what i can tell the VPN1513 GPS Reciver Module(#28506) reports its GPS coordinates in MinDEC format. So the answer to my above question is this: The two byte Fractional Minutes are in fact the MSB (Most Significant Byte) and LSB (Least Significant Byte) of the numbers to the right of the decimal in the MinDEC GPS format. So I think your example should look like this:

    GPS location is 30 degrees 15.1234
    Lat[4] = 30, Lat[3] = 15, Lat[2] and Lat[1] are actually the MSB and LSB of a word size integer representing the value to the right of the decimal (1234). I wrote a SPIN Object that reads the VPN1213 GPS and converts this number into a floating point value representing the Decimal Degree format. If anyone would like a copy i will post it to this forum.

    Thank you very much for taking the time to reply it sure helps to chat with someone.
  • max72max72 Posts: 1,155
    edited 2012-11-08 13:43
    Just a couple of ideas:
    You could try to use the raw mode. After all smart mode is intended for use with less performing micros.
    There are many objects in the obex, and also a nice app note on the site www.parallaxsemiconductor.com/
    Some of them convert to float, or you can find a lot of nice stuff, including a regexp object...
    Even better use the propeller on board. There is the firmware on the product page so you can flash to stock if you want to.
    GPS units use the NMEA protocol, and if you check it you'll find the coordinates are in the decimal minutes format as default.
    GPS is great fun and if you are interested in this kind of stuff you'll enjoy the journey for sure.
    Massimo
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-11-08 16:58
    This is a simplified Spin example of using the VPN1513, which might help in deconstructing the larger example in the Parallax docs. Note the simple formula for displaying the latitude and longitude.
    OBJ
    
    
      PST    :  "FullDuplexSerial"
      GPS    :  "FullDuplexSerial"
    
    
    CON
    
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
      GetLat   = $05
      GetLong  = $06
    
    
    PUB main 
    
    
      PST.start(31, 30, 0, 115200)
      GPS.start(0, 0, 00, 9600)                ' GPS connected to pin0
       
      repeat
        GPS.str(string("!GPS"))                   ' GPS command header
        GPS.tx(GetLat)                            '  for latitude  
        WriteVal
       
        PST.str(string(",")) 
        GPS.str(string("!GPS"))                   ' GPS command header
        GPS.tx(GetLong)                           '  for longitude 
        WriteVal
        PST.str(string(13))
        WaitCnt(ClkFreq + Cnt)                    ' Wait 1 second
      
    PRI  WriteVal | Degrees, Minutes, MinutesD, Dir, workVal
    
    
      WaitCnt(ClkFreq / 10 + Cnt)                 ' 1/10 second wait
    
    
      Degrees := GPS.rx                           ' Retrieve bytes from GPS
      Minutes := GPS.rx
      MinutesD := (GPS.rx << 8) | GPS.rx
      Dir := GPS.rx==1
      
      if dir == -1                                ' If Dir = -1, prepend - sign
        PST.str(string("-"))
      PST.dec(Degrees)
      PST.str(string("."))
    
    
      workVal := (Minutes * 1000 / 6) + (MinutesD / 60)
      PST.dec(workVal) 
    

    -- Gordon
  • JohnR2010JohnR2010 Posts: 431
    edited 2012-11-09 09:40
    Thanks Max and Gordon im off and running now!! Here is an SPIN Object i wrote that converts the Lat, Long, Altitude, Speed, and Heading to a signed floating point value for each. I also included a very simple local time zone method that is based on the general guideline that time zones change every 15 degrees of longitude. Just an estimate will get the local time zone close. The project i'm working on needs GPS coordinates as real numbers in DEC format (not just formatted for display) so i can do calculations. This object may be a bit more complicated than what most people might need but i will post it anyway maybe it will help someone. I get so much from this forum what a great group of guys and gals!!
Sign In or Register to comment.