Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to use the auduino TinyGPS library for another microcontroler

Status
Not open for further replies.

Amalinda

Banned
Full Member level 1
Joined
Sep 25, 2012
Messages
104
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Visit site
Activity points
0
Is there anyone who would know how to use the TinyGPS library made for auduino on MSP430 Code Composer Studio Compiler? the library is make out of C++ and CCS compiles C++ as well. so, I should I think must have no trouble. But I would appreciate any advises with regard to this.

thanks
 

Can you please provide a simple way I could add this library to my compiler? it is Code Composer studio. How should I know how to call its functions? thanks you.
 

hello,

a library is writen for a specifique micrcontroler, you can't use it for another family
of microcontroler.Even it 's appear as universel C langage.
because the linker need binary code compatible.
Instructions codes are not the same after compiling.
 

well I believe a general C function can be interpreted by any good compiler. I dont want an exact piece of code. a general guidance as to how I should extract these data withing commas would suffice.
 

Hello!

well I believe a general C function can be interpreted by any good compiler. I dont want an exact piece of code. a general guidance as to how I should extract these data withing commas would suffice.

If you have the C code, it's another story, you can compile it for any processor.
Now what you (apparently) want to do is to extract info from the NMEA data, right?
NMEA is a bunch of ascii strings. Every string has a predefined number of fields, all separated by commas.
You know for instance that the string starting by $GPRMC contains the latitude at the 5 th field.
So you just extract the $GPRMC string and eliminate what you don't need, that's it.

If I were you, I would start by writing 2 functions like this:


Code C - [expand]
1
2
char * GetString(const char * label);
char *  GetField(const char * instring, uint8 fieldid);



The first one would return the string you want (e.g. staring by the label you are looking for).
The second one would return the field you are looking for (e.g. fieldid = 3 would return the 3rd field).

Then I guess you're done.

Dora.
 
hey thanks! one general function. Pass the input which which field needs to be extracted and It passes the same to an array:) it might save me code space rather the having a function for each data field required.

- - - Updated - - -

btw, do you know why all these libraries (most of them for most micros) are written in C++? I only know C so... jurst wondering if its worthwhile learning it.
 

Hello!

Basically C++ IS C.

In C, you have structures. A structure can contain anything, including function pointers.
Just imagine a structure like this:


Code C - [expand]
1
2
3
4
5
6
7
typedef struct {
    char NMEABuffer[NMEA_SIZE];
    float (*GetLat)(void);  // Function pointer returning latitude
    float (*GetLong)(void);  // Function pointer returning longitude
    char * (*GetString)(const char * label);
    char * (*GetField)(const char * instring, uint8 fieldid);
} GPSStruct;



in C++, you would write:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class GPSObj {
public:
    GPSObj();
    virtual ~GPSObj();
    float GetLat(void);
    float GetLong(void);
protected:
private:
    // Functions that don't have to be known outside (nobody cares about the buffer,
    // what the user wants is results (GetLat, GetLong, etc...) and these are public).
    char * GetString(const char * label);
    char * GetField(const char * instring, uint8 fieldid);
    char NMEABuffer[NMEA_SIZE];
};



In one case you would say:

GPSStruct GS;

and get the latitude by calling GS.GetLat();

And in the other case, you would say

GPSObj GO;

and get the latitude by calling GO.GetLat();

And nothing prevents you to call your structure GPSObj, so you get the exact same implementation code.

Dora.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top