Shop OBEX P1 Docs P2 Docs Learn Events
GPS metric to your kind — Parallax Forums

GPS metric to your kind

jokerswildjokerswild Posts: 31
edited 2008-09-21 11:26 in General Discussion
G'day folks,

I'm reading nmea from a gps and its metric ie 27.407544 which should be 27.404544.

Is there an easy way to do this calculation? Or is there a standard way to change output format on the gps? (its rs232)

If someone wants to get in depth, its on a SX28.

Thanks for any help!

Michael.

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2008-09-16 11:48
    I can't quite tell what you're asking, but I'll bet that your issue is that you have degrees and decimal fractions of degrees, and you want degrees, minutes, seconds. Right?

    If you had 27.5000 that would be 27 and a half degrees, which is 27 degrees and 30 minutes. You take away the 27 degrees, and multiply the remainder by 60 (.5*60 = 30). You'll have to store the minutes and seconds separately from the degrees (that is, three separate variables), and then put them back together in your display code.

    If you had 27.5050, you'd take away the 27 and store it in your degrees variable, multiply the .5050 by 60 to get 30.3, put the 30 in your minutes variable, and multiply the .3 by 60 to get 18 seconds to store in your seconds variable.

    Now the numbers you give in the example look a little odd. If your problem is purely the decimal<->ddmmss conversion, why is the ".40" part the same in both? I'm not sure what's going on there.

    Post Edited (sylvie369) : 9/16/2008 11:57:02 AM GMT
  • jokerswildjokerswild Posts: 31
    edited 2008-09-16 20:20
    Ah your correct, sorry for my misleading example.

    Thanks for your idea, i think it will be the way to go. Its good to see you still know what i'm talking about even with my bad information.

    Cheers!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-09-16 20:55
    The open source firmware for the Parallax GPS Modules uses an SX28 and converts the data from the module into its individual pieces. Perhaps that information would help you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • jokerswildjokerswild Posts: 31
    edited 2008-09-21 11:26
    Thanks Chris.
Sign In or Register to comment.