GPS GROUND SPEED

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

GPS GROUND SPEED

Post 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
Attachments
GPS Time and Date position.fcf
(16.5 KiB) Downloaded 319 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GPS GROUND SPEED

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

wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

Re: GPS GROUND SPEED

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GPS GROUND SPEED

Post by Benj »

Hi Wayne,

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

Let me know how you get on.
Attachments
GPS Time and Date position.fcf
(16.52 KiB) Downloaded 333 times

wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

Re: GPS GROUND SPEED

Post by wayne millard »

Hi Benj,

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

wayne :P

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GPS GROUND SPEED

Post 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

wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

Re: GPS GROUND SPEED

Post by wayne millard »

Thanks Benj

Post Reply