Page 1 of 2

Help needed GPS calculation!

Posted: Fri May 14, 2021 9:19 pm
by jgu1
Hi all!

In another project where I have to calculate the distance by measure the speed from a GPS I have made a program to try to get it work, but no luck.

I found a formel for this on the web: Distance = Speed * time in minute / 60

I use an ESP32 and ILI9341spi with touch. Work perfect.

First I get the speed from the GPS Work!
Then I add the speed every 30 second and count every time to get the average speed.
I also made in interrupt for counting the minute I use in the calculation to get the distance.

Finally I press in the screen to get the result/distance, but only get a 0. Spend a lot time. of course I have done something wrong. Please any advice :D

Thank´s in advance.

Br jorgen

Re: Help needed GPS calculation!

Posted: Mon May 17, 2021 9:32 am
by Steve-Matrix
The order of precedence of multiply and divide is the same, and so the divide in your formula could happen before the multiply. If you are using integer variables, then the following could happen:

Say speed = 100 and time = 20, then distance = 100 * 20 / 60 = 100 * (20 / 60) = 100 * 0 = 0.

To get around this, you could make sure the multiply is forced to be evaluated first by using brackets around (speed * time). Or a more accurate way (if speed is not essential) would be to use floating point variables (in which case you should also force constants like 60 to be floats by writing them as 60.0).

Of course, there could be something else going on in your program. But the above may help.

Re: Help needed GPS calculation!

Posted: Mon May 17, 2021 6:10 pm
by jgu1
Hi Leigh!

Many thank´s Leigh. It's been many years since I went to school. :lol: I'm trying to change the calculations.

Br Jorgen

Re: Help needed GPS calculation!

Posted: Tue May 18, 2021 8:52 pm
by jgu1
Sorry wrong person, I mean Steve. :lol:

Jorgen

Re: Help needed GPS calculation!

Posted: Wed May 19, 2021 9:22 am
by Steve-Matrix
Thanks, Jorgen. :)

flowcode v9 gps click bl0106

Posted: Mon Oct 31, 2022 5:18 pm
by monie
Image
Er der nogen der har FlowcodeV9 Coder, så jeg kan afprøve GPS click enheden som vist på billedet nedenfor?
Does anyone have Flowcode 9 Codes so I can test the GPS click device as shown in the picture below?

Jeg benytter EBlocks2 dsPIC Programmer BL0032-1
I use EBlocks2 dsPIC Programmer BL0032-1

Uses Display type: 20 x 4 Using the LCD diaplay

Med venlig hilsen
Monie

Re: Help needed GPS calculation!

Posted: Mon Oct 31, 2022 6:18 pm
by chipfryer27
Hi

As far as I am aware, the default configuration for the module is to use NMEA, which is the protocol used in the Flowcode Generic GPS component (available under Comms).

Unfortunately I don't have a module to try, but I'd maybe look at connecting using UART which may mean "mapping" the component Rx pin to suit.

Sorry I can't be of more help.

Regards

Re: Help needed GPS calculation!

Posted: Wed Nov 02, 2022 5:06 pm
by monie
Thank you very much for replying.
But I would like the GPS device to work on: dsProgrammer dsPIC BL0032-1 is it possible?

Re: Help needed GPS calculation!

Posted: Wed Nov 02, 2022 6:31 pm
by chipfryer27
Hi

I don't have the module nor that Programmer.

However it appears you are using a BL0106 "Click Board"too. That board takes standard MikroElektronica "Click" modules and allows connection to Eblocks such as your BL0032.

If you download the Eblock datasheet

https://www.matrixtsl.com/resources/fil ... asheet.pdf

You will find the BL0106 schematic on page 9 and the BL0032 on page 44.

From the BL0106 schematics it shows the corresponding Port Connections to the "Click" connections.

Port 0 = uC Rx/Click Tx
Port 1 = uC Tx / Click Rx
etc

Therefore if you were to plug your BL0106 into Port B of the BL0032, you would receive whatever was being sent from the Click on Port B0 and to send to the Click you would use Port B1.

When you start a New Project you will be selecting your BL0032 as the target. If you then plug in your BL0106 into Port B (you can use any Port) and add the Generic GPS component to your Dashboard Panel, under Properties you will be able to select the Pin to use as the Receive.

Capture.JPG
Capture.JPG (84.97 KiB) Viewed 5332 times

I only used Port B as an example, you could use whatever you wish.

I don't have those boards / modules so whilst the above illustrates how to "connect" pins/ports of your Click/Programmer board, I'm not saying it will work straight away. You may need to send config to the Click or such like and for that you may need to use the UART component instead (connected as above etc).

Hope this helps a little and good luck. Let us know how you get on.

Regards

Re: Help needed GPS calculation!

Posted: Thu Nov 03, 2022 3:05 pm
by monie
Hello all Flowcode users

Does anyone have an example of Flowcode V9 codes so I can test the GPS-click device as shown in the picture?

Regards