AnsweredAssumed Answered

how to understand one of the TS201 examples ----about the sampling!

Question asked by shedmaze on Jan 28, 2012
Latest reply on Jan 30, 2012 by CraigG

hello, aces:


i am a TS201 beginner, and i am learning the examples that are included in the Visual DSP++ software, and one of them make me confused, it is placed here "D:\visual_dsp++\TS\Examples\ADSP-TS201 EZ-KIT Lite\Power_On_Self_Test\CoreA", i am learning it now, and the problems that confused me are:


(1). there are many main() functions in this project, i think that are not right, you can check it, in every .c file, there is a main() function.

(2). in the audio_test.c file, i can't understand the macro's meaning at the beginning of the file:

          #define MAX_SAMPLES      256
          #define REQUIRED_SAMPLES   ((MAX_SAMPLES) * 250)
          #define DESIRED_FREQ     ((float)3000.0)
          #define SAMPLE_RATE     ((float)48000.0)
          #define AMPLITUDE     ((float)8388607)
          #define PI       ((float)3.141592765309)

          #define ACCEPTABLE_DEVIATION_PCT ((float)0.015)
          #define MIN_SIGNAL_STRENGTH   (float)30.0


     how do you understand the "REQUIRED_SAMPLES" and the "DESIRED_FREQ" and the "SAMPLE_RATE" ? i think the "DESIRED_FREQ" and the "SAMPLE_RATE" are the same defination, but it sames that i am wrong.


(3). in the  audio_test.c file, i don't know what does the author want to do?  especially this part in the "int Test_Channel(float* pfRealIn) " function, i don't understand :


twidfft(w, MAX_SAMPLES);

    // Real input array fills from a converter or other source
rfft( pfRealIn, t, out, w, 1, MAX_SAMPLES);

    // Arrays are filled with FFT data
    // scan the output array for the highest real value
fTempFreq = (float)sqrt(out[0].re*out[0].re+out[0].im*out[0].im);
  for (nSampleNumber=1; nSampleNumber < (MAX_SAMPLES / 2); nSampleNumber++)
  if( ((float)sqrt(out[nSampleNumber].re*out[nSampleNumber].re+out[nSampleNumber].im*out[nSampleNumber].im)) > fTempFreq )
      fTempFreq = (float)sqrt(out[nSampleNumber].re*out[nSampleNumber].re+out[nSampleNumber].im*out[nSampleNumber].im);
   nHighestFreqIndex = nSampleNumber;

   // multiply the index of the array of the highest value with the sample rate value
   fSampledFrequency = nHighestFreqIndex * (SAMPLE_RATE / MAX_SAMPLES);





so, i don't understand this project, can anybody help me??  thank you~