Hi,
Yes, convert from degrees which is the number in column A to radians which is what Excel wants.
1) The SIN of an angle of 0-360° varies from -1 to +1 since we're going to use the values to set a PWM dutycycle we can't have negative numbers, we can't have a dutycycle of LESS than 0. So we add 1 to get a value ranging from 0 to 2 instead of +/-1.
2) Then we divide that by 2 to get the value ranging from 0 to 1 to make the next step more logical...
3) Again, since we're going to use the final value to set the dutycycle produced by the PWM generator we can't have the value ranging from 0 to 1, we need to scale the value up to match the number of bits of resolution we have in the PWM generator. If it's 8 bits multiply by 255 to get a value ranging from 0 to 255 (0 is 0% dutycycle, 255 is 100% dutycycle). If you have 9 bits resolution multiply by 512 and so on.
/Henrik.
Bookmarks