how do I parse NMEA data from the GPS unit and output into Mbed?

23 May 2012

I've been searching everywhere for a simple code that parse the small GPS MN5010HS unit I have and couldn't find one.

i've found lot's of website that explains to me the NMEA data sentence but nothing on how to request the data from a microcontroller.

EDIT Can Someone with knowledge of MODGPS library help me? my program only prints once and never again.

18 May 2012

Not sure that I understand your question, but there are NMEA gps decoders on the cookbook page, for example:

http://mbed.org/cookbook/GlobalSat-EM-406-GPS-Module and http://mbed.org/cookbook/MODGPS

18 May 2012

Hi Wim,

Ah I din't know I could use that to parse data. Really embarrassing. Now I'm trying to compile the MODGPS library. But for some reason it won't compile.

Here's my main program



#define COMPILE_EXAMPLE_CODE_MODGPS
#define PCBAUD 115200
#define GPSRX p9
#define GPSBAUD 4800
//#define PPSPIN p29
#include "/MODGPS/example1.cpp"


The error given was:

" Undefined symbol main (referred from rtentry2.o)." in file "/"

I already added all the necesseary library files. and the whole MODGPS library.What could still be the problem?

And I don't understand the part where it asked me to define the PC baud. is it set as 115200 for all pc's? How do I know what is my Pc's baud rate.

19 May 2012

PCBAUD refers to the baudrate of the USB virtual com port that is connected to your PC terminal program (eg hyperterminal). You need to set that baudrate in the com port settings menu of hyperterminal. The terminalwindow will show mbeds pc.printf messages. Default setting will be 9600 baud.

You may be missing the actual example code and thus your 'main' function. Seems that the first define is wrong. Should be:

#define COMPILE_EXAMPLE1_CODE_MODGPS

instead of:

#define COMPILE_EXAMPLE_CODE_MODGPS

You can also try EXAMPLE2 or EXAMPLE3. The code is in the library and you can inspect it.

PS looks like there is also a typo in the example: GPSBUAD.. instead of GPSBAUD...

Perhaps best to copy the example code in your own main and take it from there. Obviously you should not use the define COMPILE_EXAMPLE1_CODE_MODGPS in that case.

21 May 2012

Okay that solves the problem. compile was successful. But it only prints once showing a 00 lat and 00 long, then it never did anything again. I thought it's cause of wrong baud rate, But everything checks out.

I copied out the example code and comment out the COMPILE_EXAMPLE1_CODE_MODGPS. Changed the GPSBUAD TO GPSBAUD.

Maybe I'm indoor's that's why it won't print? But it should print every 3 seconds no matter if it had a lock or not.

PCBAUD 9600

GPSBAUD 4800 - using NMEA 0183 setting

23 May 2012

Can anyone else help me on my problem? Will Huiskamp doesn't seem to be here.

23 May 2012

I get the warning ""reference is to variable "i" (declared at line 129) under old for-init scoping rules it would have been variable "i" (declared at line 170)" in file "MODGPS/GPS.cpp", Line: 173, Col: 21"

Is that a problem & i'm using example 1 just the way you are and its not printing anything Using PC and GPS baud of 38400

Any help will be greatly appreciated.