Other Parts Discussed in Thread: DRV8301, CONTROLSUITE
Hi:
I am using C2000 28069M with DRV8301 EVM. I have some error of calculation based on IQmath.
Dvision, multiply, square root, give me the correct result. But sinPU function give me the wrong result.
What could cause this?
Here is my source code:
#include "IQmathLib.h"
#include <math.h>
/*
* main.c
*/
#define GLOBAL_Q 24
_iq input, div_out;
_iq angle, sin_out;
_iq mpy_a, mpy_b, mpy_out;
_iq sqrt_a, sqrt_out;
void main(void )
{
input=_IQ(0.25);
angle = _IQ(0.1);
mpy_a = _IQ(2.1);
mpy_b = _IQ(3.0);
sqrt_a = _IQ(2.0);
div_out =_IQdiv(_IQ(0.1),_IQ(0.2)); // divide test sin
sin_out = _IQsinPU(angle); // sinPU test sin1 = sin(36degree) = 0.5877
mpy_out = _IQmpy(mpy_a,mpy_b); // multiply test, mpy_out = 2.1*3.0 = 6.3
sqrt_out = _IQsqrt(sqrt_a);
for(;;)
{
asm(" NOP");
}
}
Result is show below(right top corner)
Thanks in advanced
