I am using Code Composer Studio 3.1 with DSP TMS320F2812.
my trig functions are giving wild results. Here are some examples in my code snippet below:
#define PI 3.1415926535897932384626433832795028841971693993751
void InitLookupTable(void)
{
int j=0;
double u = 0.0;
double v = 0.0;
memset(SineLookup, 0, sizeof(SineLookup));
v = sin(PI/2); // 1
v= cos(PI); // 1
v=cos(0); // 20800
v=cos(PI/2); // -16384
v=sin(3*PI/2); // 1
for(j= 0; j<512; j++)
{
u = sin(0.703125*j*PI/180);
SineLookup[j] = u;
}
return;
}
When I try to create a lookup table of sine(x), 0<x<2*PI, I get crazy values all over the place, including
large positive and negative values as above, and also a ton of zero values.
I am on Windows XP, SP 2. Can anyone tell me what's wrong?