Page 1 of 1

GPS GROUND SPEED

Posted: Thu Mar 25, 2010 11:35 am
by wayne millard
Hi Team,

Can you please look at my code and see why ground speed in mph will not work.

Thanks
Wayne :P

Re: GPS GROUND SPEED

Posted: Thu Mar 25, 2010 1:24 pm
by Benj
Hi Wayne,

I have had a quick look at your program and the reason the code is not working correctly is due to things like this.

mph = ground_speed/0.44704

This would instead have to use the floating point functions.

float = fdiv(ground_speed, 0.044704)

If your ground speed variable in an integer or a byte then you will first have to convert it to a float.

fgnd_sp = int2float(ground_speed)
float = fdiv(fgnd_sp, 0.044704)

The float functions are available from the functions button in the calculation icon.

There is lots of information on the forums regarding these functions.

Re: GPS GROUND SPEED

Posted: Thu Mar 25, 2010 3:38 pm
by wayne millard
Hi Benj,

Thanks for the help can you show me a example of how to do this because im lost.

Thanks,
Wayne :P

Re: GPS GROUND SPEED

Posted: Fri Mar 26, 2010 10:51 am
by Benj
Hi Wayne,

This program should now compile and run correctly on the hardware.

Let me know how you get on.

Re: GPS GROUND SPEED

Posted: Fri Mar 26, 2010 11:29 am
by wayne millard
Hi Benj,

Thanks for the help but i get a error when i compile to hex.

wayne :P

Re: GPS GROUND SPEED

Posted: Fri Mar 26, 2010 1:53 pm
by Benj
Hello Wayne,

The error is related to this line of C code near the start of your program.

float_detect_tininess = long;

This should instead look like this.

float_detect_tininess = 1; //Detect tininess before divide

or

float_detect_tininess = 0; //Detect tininess after divide

Re: GPS GROUND SPEED

Posted: Fri Mar 26, 2010 2:16 pm
by wayne millard
Thanks Benj