Jump to content


Photo

Any NMEA to binary converters for PIC?


  • Please log in to reply
15 replies to this topic

#1 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 25 November 2003 - 08:43 AM

Hi all, I have scoured the net for some time in search of code for a PIC (preferably in assembly) that can parse NMEA sentences, convert the data to a binary format, and calculate basic navigational parameters such as distance and angle to a waypoint. I keep thinking that SOMEONE must have tackled this task already, but I have yet to find it. Does anyone have links to such a project?

I have seen code that will read NMEA and spit it out to an LCD, but the data stays in ASCII. For the purposes of a UAV, however, a binary conversion is needed so that flight parameters can be calculated.

I have been working on such routines, but I'm not done yet, and I would like as much input as possible. If anyone has links, please post them.

Thanks,
Nathan

#2 mikep

mikep

    RC-Cam Mentor

  • Members+
  • PipPipPipPipPip
  • 202 posts
  • Location:Montreal, Quebec, Canada

Posted 25 November 2003 - 01:25 PM

If you mean that you want the "NUMERIC" value from an ASCII decimal value simply subtract 48 from each number.

So if you have it in hex lets say numeric 45 for instance is: 3435. In decimal that would be 52 53 (subtract 48 from each digit) = 4 5.

Get it?

Edited by mikep, 25 November 2003 - 01:26 PM.


#3 Mr.RC-Cam

Mr.RC-Cam

    RC-Cam Mentor

  • Admin
  • PipPipPipPipPip
  • 4,654 posts
  • Location:USA
  • Interests:R/C video and photography.

Posted 25 November 2003 - 01:58 PM

... and calculate basic navigational parameters such as distance and angle to a waypoint.

From what I have heard in prior discussions, the waypoint features built into the handheld GPS products have been used for this. That is to say, the consumer GPS units calculates it all for you and points you to the direction that you should travel via the NMEA sentences.

The little OEM GPS modules do not have such features, which is one of the reasons they have not been popular around here. However, an external microcontroller that you could add your waypoints too would be a way to solve this. None have been mentioned though, so you might be on your own.
- Thomas

#4 mikep

mikep

    RC-Cam Mentor

  • Members+
  • PipPipPipPipPip
  • 202 posts
  • Location:Montreal, Quebec, Canada

Posted 25 November 2003 - 03:15 PM

If you want to calculate disctance use the formulas found here.

http://abe.www.ecn.p...web_ssm/web_GPS

http://abe.www.ecn.p..._ssm/web_GPS_eq

If you don't know about WGS84 then start here:

http://www.wgs84.com/wgs84/wgs84.htm

#5 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 25 November 2003 - 10:06 PM

If you mean that you want the "NUMERIC" value from an ASCII decimal value simply subtract 48 from each number.

So if you have it in hex lets say numeric 45 for instance is: 3435. In decimal that would be 52 53 (subtract 48 from each digit) = 4 5.

Get it?

Thanks for the reply. What you describe is a conversion to unpacked binary coded decimal format. That's the first step in converting it to a useable binary, but you still have to convert the BCD to binary and scale it to a useable number. The degrees and minutes are different units, for example.

Nathan

#6 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 25 November 2003 - 10:11 PM

The little OEM GPS modules do not have such features, which is one of the reasons they have not been popular around here. However, an external microcontroller that you could add your waypoints too would be a way to solve this. None have been mentioned though, so you might be on your own.

I have OEM modules (Motorola oncore) and they don't support waypoint calculation. I'm mostly done with my code though, and I have plans to make it accessible to others. I was just hoping to compare my code with others and refine it with other ideas. Anyway, thanks for your input.

Nathan

#7 mikep

mikep

    RC-Cam Mentor

  • Members+
  • PipPipPipPipPip
  • 202 posts
  • Location:Montreal, Quebec, Canada

Posted 26 November 2003 - 04:36 AM

you still have to convert the BCD to binary and scale it to a useable number. The degrees and minutes are different units, for example.

Use the formulas I linked to to convert to decimal degrees.

Take a look at this excel spreadsheet to get some examples.

http://abe.www.ecn.p...xls/web_GPS.xls

#8 MikeDD

MikeDD

    RC-Cam'er

  • Members+
  • PipPip
  • 63 posts

Posted 26 November 2003 - 05:49 AM

I have OEM modules (Motorola oncore) and they don't support waypoint calculation. I'm mostly done with my code though, and I have plans to make it accessible to others. I was just hoping to compare my code with others and refine it with other ideas. Anyway, thanks for your input.

Nathan

I would like to see this as I have an Oncore and an old Trimble SVee6 OEM units.
I have some code that does the opposite, binary to NMEA for some Askin-Seki units Mavin sold years ago. These only had a binary output.

#9 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 26 November 2003 - 07:11 AM

Use the formulas I linked to to convert to decimal degrees.

Take a look at this excel spreadsheet to get some examples.

http://abe.www.ecn.p...xls/web_GPS.xls

The links were pretty informative, but knowing the conversion formulas and proceedures, and actaully implementing them on an 8-bit uC are two very different things. I'm looking for the later of the two. I'd like PIC code that implements the conversion formulas.

Thanks,
Nathan

#10 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 26 November 2003 - 07:17 AM

I would like to see this as I have an Oncore and an old Trimble SVee6 OEM units.
I have some code that does the opposite, binary to NMEA for some Askin-Seki units Mavin sold years ago. These only had a binary output.

I looked at the Askin code for some time because it looked like it would do everything I'm looking for. They don't clearly state that the ouput of these units is binary, so I kept hunting aroud for the NMEA sentence parsing. Never found it though. <_<

When I finish my code I will probably post it. If not, I can send you a copy directly.

Nathan

#11 mikep

mikep

    RC-Cam Mentor

  • Members+
  • PipPipPipPipPip
  • 202 posts
  • Location:Montreal, Quebec, Canada

Posted 26 November 2003 - 01:26 PM

The links were pretty informative, but knowing the conversion formulas and proceedures, and actaully implementing them on an 8-bit uC are two very different things.

I leave the 16-bit and 32-bit math to the high level compilers. But if you are set on ASM there might be something here that might help you.

http://www.piclist.c.../math/index.htm

I understand this is not what you are looking for. But I have a feeling no one here as come across it, or they are not willing to share it. So I'm trying to provide you the pieces.

My ASM experience is limited to only "WHEN I HAVE TO" use it. Otherwise I would try and provide you with some more complete routines since this is stuff that also interest me. But I don't like torturing myself to get it to happend in ASM and prefer using high level languages.

Cheers,
Mike

Edited by mikep, 26 November 2003 - 01:48 PM.


#12 quemazon

quemazon

    RC-Cam Visitor

  • Members+
  • Pip
  • 9 posts
  • Location:New Mexico

Posted 26 November 2003 - 04:57 PM

I leave the 16-bit and 32-bit math to the high level compilers. But if you are set on ASM there might be something here that might help you.

http://www.piclist.c.../math/index.htm

I understand this is not what you are looking for. But I have a feeling no one here as come across it, or they are not willing to share it. So I'm trying to provide you the pieces.

My ASM experience is limited to only "WHEN I HAVE TO" use it. Otherwise I would try and provide you with some more complete routines since this is stuff that also interest me. But I don't like torturing myself to get it to happend in ASM and prefer using high level languages.

Cheers,
Mike

Yes, I've been using the piclist quite extensively for all of my routines. Eventually I should move up to a higher level language, but for now MPASM is free, universal, and forces me to understand what the PIC is doing.

As for the math, it turns out that all I've needed is a 32 bit addition and negate, a 16x8 multiply and an 8 bit arctangent. The full set of routines is right around 500K.

What compiler do you prefer, BTW?

Nathan

#13 MikeDD

MikeDD

    RC-Cam'er

  • Members+
  • PipPip
  • 63 posts

Posted 26 November 2003 - 06:32 PM

I looked at the Askin code for some time because it looked like it would do everything I'm looking for. They don't clearly state that the ouput of these units is binary, so I kept hunting aroud for the NMEA sentence parsing. Never found it though. <_<

Here is the 16F84 project for Askin binary to NMEA.
VK2GWK's page

#14 mikep

mikep

    RC-Cam Mentor

  • Members+
  • PipPipPipPipPip
  • 202 posts
  • Location:Montreal, Quebec, Canada

Posted 26 November 2003 - 06:52 PM

What compiler do you prefer, BTW?

I use both PicBasic Pro and CCS C.

I don't really have a preference but lately have been using the PBP more. Simply because I've been in touch with people that use it. I actually have a lot more experience in C/C++.

Somewhere I read about a C compiler available on Microchips site, but I haven't looked into it. I have enough on my plate with the one's I have! :-)

#15 Kilrah

Kilrah

    RC-Cam Mentor

  • Trusted Member
  • PipPipPipPipPip
  • 2,079 posts
  • Location:Switzerland
  • Interests:Modelling, electronics, computers

Posted 06 December 2003 - 02:23 PM

As far as I know microchip unfortunately only have a C compiler for the PIC17.. and 18.. series

#16 radiohound

radiohound

    RC-Cam Visitor

  • Members+
  • Pip
  • 16 posts

Posted 01 February 2009 - 05:19 PM

Hi all, I have scoured the net for some time in search of code for a PIC (preferably in assembly) that can parse NMEA sentences, convert the data to a binary format, and calculate basic navigational parameters such as distance and angle to a waypoint. I keep thinking that SOMEONE must have tackled this task already, but I have yet to find it. Does anyone have links to such a project?


Well, it looks like I am about 6 years late, but here is a project that does just that. MikeP originally wrote some of the base autopilot code, and I added the internal navigation code, etc. It does it on a PIC16F, and can keep up with GMRC on a 5 hertz GPS. Parsing is done with PicBasic, and the navigation math is done with assembly. Having trouble parsing an additional sentence at that speed though.

http://www.rcgroups....ad.php?t=993046

Edited by radiohound, 02 February 2009 - 02:44 PM.