Part Number: TMS320F28069M
Tool/software: Code Composer Studio
Hi all
I have some problem with a code with trigonometric functions or synchronization, I'm using the next functions:
sin(w*t)*Vin and cos(w*t)*Vin
where sine and cosine are giving me the correct values, that I can corroborate by putting a breakpoint and doing it step by step (or by calculating them, I achieve expected values), but then I need to apply a low pass filter by multiplying the sine and cosine by one signal I'm reading from the ADC (during the same interruption). The problem Is that I don't achieve the values I expect and the only way to have the desired values (correct ones) is by reading sine and cosine from outside (trough ADC too and from the same source)
in the code (inside interruption, I'm applying this in the ADC_SOC example )
REading values (ADC):
sinRT_dsp = AdcResult.ADCRESULT4;
sinRT = (((double)sinRT_dsp) /4096*3.3* 20/33)-1; //Scaling factor 33/20 to achieve 3.3 Volts at the output so Sine Cosine will go from -1 to 1
cosRT_dsp = AdcResult.ADCRESULT5;
cosRT = (((double)cosRT_dsp) /4096*3.3* 20/33)-1; //Scaling factor 33/20 to achieve 3.3 Volts at the output so Sine Cosine will go from -1 to 1
Generated sinusoidal values
u_one = sin(wp*2*pi*tot_time)*vin;
u2_one = cos(wp*2*pi*tot_time)*vin;
Both give me values between -1 and 1, butr i dont converge to same result and I know the one reading ADC values is working properly.
Hope someone could help me to understand the problem. Thanks in advance
Best!
Maria