#define NUM_FFT 128 // Length of FFT to process
typedef struct
{
// s16 iRealArray[NUM_FFT];
// s16 iMageArray[NUM_FFT];
float iRealArray[NUM_FFT];
float iMageArray[NUM_FFT];
u16 FU[3]; //---基波电压---NNN.N6
u32 FI[4]; //---基波电流NNNN.NNNN
u32 HarmonicpercentU[51];
u32 HarmonicpercentI[51]; //---谐波含有率--NNN.N6
}sDl645FftHarmonicData_TypeDef;
sDl645FftHarmonicData_TypeDef HarmonicData;
float ftemp;
for(i=0;i<NUM_FFT;i++) HarmonicData.iMageArray = 0;
FFT(HarmonicData.iRealArray, HarmonicData.iMageArray);
ftemp_N = (float)(((float)HarmonicData.iRealArray[1] *(float)HarmonicData.iRealArray[1]) + ((float)HarmonicData.iMageArray[1] * (float)HarmonicData.iMageArray[1]));
这步之后ftemp就为0了,哪里出错了? |