real number from pic ???

Thread Starter


Joined Jan 12, 2013

I have an angle in the microcontroller from 0 to 360 , and I want to calculate its Sin , and display this number as analog .

I use CCS compiler , and I think that the Math library exists.

the hard thing how to convert the number from 0 to 1 ( if we neglige the negatif numbers ) , and with 3 digits after the point . (0.000,0.001,....,0.999,1.000) to a voltage .

Ex: if the angle=60 : sin(60)=0.8660254≈0.866 ===> 0.866V



Joined Sep 7, 2009
If you want to output the voltage to read on a multimeter, etc, you can use a PWM pin / software PWM, and a resistor capacitor filter to make it into a stable voltage.


Joined Mar 31, 2012
What do you mean "convert it to a real number in volts"? This doesn't make a lot of sense, just like saying "display this number as analog" doesn't make a lot of sense in your first post.

Are you saying that you need to output a representation of it as an analog voltage? If so, what conversion factor are you trying to get (how many volts per degree)? What about negative angles?