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/TMS320F28379D: tms320f28379d

Part Number: TMS320F28379D


Tool/software: Code Composer Studio

I'm using TMS320F28379D with its docking station.

I use RFFT_ADC example code, and I have a question.

    hnd_rfft_adc->Tail = &(hnd_rfft->OutBuf);
   
    hnd_rfft->FFTSize   = RFFT_SIZE;       //FFT size
    hnd_rfft->FFTStages = RFFT_STAGES;     //FFT stages
    hnd_rfft_adc->InBuf = &RFFTin1Buff[0]; //Input buffer (16-bit ADC) input
    hnd_rfft->OutBuf    = &RFFToutBuff[0]; //Output buffer
    hnd_rfft->CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor
    hnd_rfft->MagBuf    = &RFFTmagBuff[0]; //Magnitude output buffer

In this code, I need to take absolute value for data stored in RFFToutBuff.

So, I add a code like this,

RFFToutBuff[0]=fabsf(RFFToutBuff[0]);

And, I think I am not correct.

How can I take absolute value for RFFToutBuff data?

Thank you

  • fabsf() should be the correct way to get the absolute value. What is the value of RFFToutBuff[0] before? What is it after?

    Whitney

  • Thank you Whitney

    Code goes like this

    hnd_rfft->FFTSize = RFFT_SIZE; //FFT size
    hnd_rfft->FFTStages = RFFT_STAGES; //FFT stages
    hnd_rfft_adc->InBuf = &RFFTin1Buff[0]; //Input buffer (16-bit ADC) input
    hnd_rfft->OutBuf = &RFFToutBuff[0]; //Output buffer
    hnd_rfft->CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor
    hnd_rfft->MagBuf = &RFFTmagBuff[0]; //Magnitude output buffer
    RFFToutBuff[0]=fabsf(RFFToutBuff[0]);

    And, I wonder it is correct or not for taking absolute value for data stored in RFFToutBuff.

    The original data in RFFToutBuff[0] have negative value, and the value after that has the same negative value.
  • Hello,

    Sorry for the slow response. Are you still having trouble with this? Can you take a look at the disassembly window and see what kind of code was generated for fabsf(). That might give us some hint about what is going wrong.

    Whitney