This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28069M: ADC and sine cosine generated inside the code

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

  • Hi Maria,

    I can't see exactly why this should not be working.  Could you let me know all the changes you have made to the ADC_SOC project so I can try to re-create the issue please?

    If you have only modified the main example file ("Example_2806xAdcSoc.c"), please could you attach that file?

    Thanks.

    Regards,

    Richard