Sign in to follow this  
Followers 0

Any NMEA to binary converters for PIC?

16 posts in this topic

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

... 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.

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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.purdue.edu/~abegps/web_...xls/web_GPS.xls

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.purdue.edu/~abegps/web_...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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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.com/techref/microchip/m.../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

Share this post


Link to post
Share on other sites

Posted

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.com/techref/microchip/m.../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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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! :-)

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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.com/forums/showthread.php?t=993046

Edited by radiohound

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0