Sine & Cosine Calculator
Posted: Fri Apr 13, 2012 6:48 pm
Flowcode for 8bit pics does not have a function for calculating sines and cosines.
This means the use of either a 16bit device, or calculating the value by some method.
This is one of several ways of doing it. This only needs the basic float calculation functions. (fmul, fdiv, fadd, fsub)
It is quite easy to calculate a reasonable approximation of the value by means of the attached program.
I have written in FC4 so as to make it available to as many users as possible.
The value for the angle to be calculated is entered in the first calculation icon in either sine or cosine macro. The program takes care of conversion to radians.
Decimal angles can be used.
It is not as accurate as a calculator etc, and will fall off in accuracy after about 4 or 5 places.
It also only seems to work for angles <= 180 degrees
This means the use of either a 16bit device, or calculating the value by some method.
This is one of several ways of doing it. This only needs the basic float calculation functions. (fmul, fdiv, fadd, fsub)
It is quite easy to calculate a reasonable approximation of the value by means of the attached program.
I have written in FC4 so as to make it available to as many users as possible.
The value for the angle to be calculated is entered in the first calculation icon in either sine or cosine macro. The program takes care of conversion to radians.
Decimal angles can be used.
It is not as accurate as a calculator etc, and will fall off in accuracy after about 4 or 5 places.
It also only seems to work for angles <= 180 degrees