Calculating Speed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
the4freels
Posts: 1
Joined: Tue May 19, 2009 7:49 pm

Calculating Speed

Post by the4freels »

Hi I am currently working on a speed camera system and have struck a slight problem. The system has basically two gates and using a simple S=D/T formula sorking out the speed. I am trying to work out how to calculate the speed if the equation does not give a direct integer answer. The Pic I am using is the 16f877A had rumours that it cannot handle floating point? Any advice welcome.

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: Calculating Speed

Post by Benj »

Hello

You could do this one of two ways.

1) Use the floating point library. It should run fine with the 16F877A. There is examples and postings on the forum about how to add the floating point library to Flowcode and how to call the floating point functions. Converting back into a string or integer variable can be a bit tricky.

http://www.matrixmultimedia.com/Flowcode_Examples.php - Right at the bottom of the page is a floating point example.

2) Multiply one of your input parameters so that instead of getting the result you actually get 5 times the result for example. This way you still have an integer number but you can devide it by 5 and get an output that is to within 0.2 of the correct result.

Post Reply