Other Parts Discussed in Thread: C2000WARE
Dear all,
I am struggling to generate a sine wave using iqmath library. However I would like to share my algorithm I devised. I ended up getting a sin wave shown in the image which is a screenshot of CCS while running the program given below.

Step1: Generate a Ramp incrementing and resetiing a integer i
Step2: Convert it into p.u and then convert into iq format
Step3: Substitute it in IQ sin function
Step4: Convert it into floating point
Step5: store in a buffer
Program:
int i,o
_iq j,cons,k,out2
//ramp generation
i= i+1;
if(i> 100) i=0;
//convert the ramp into a p.u(iq)
j=_IQ18(i);
cons = _IQ18(100);
k=_IQ18div(j,cons);
//substitute the p.u into sin function
out2=_IQ18sin(k*2*PI);
//convert sine values to floating number
o= _IQ18toF(out2);
//scale to 100
o=o*100;
//store in a buffer to graph it on CCS
AdcBuf[index] =o;
index++;
if(index == AdcBufLen) index = 0;
Regards,
Rajesh BN.
