Page 1 of 1

Calculating Speed

Posted: Thu May 28, 2009 6:36 pm
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.

Re: Calculating Speed

Posted: Fri May 29, 2009 8:22 am
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.