你好,我现在正在用28335写一个FFT求谐波畸变率程序,由于是第一次次写,所以遇到些问题,首先问一下,调用FFT库需要对CCS进行配置吗?现在我写的程序感觉虽然调用的函数,但是该函数并没有执行
sf h:
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#include <math.h>
//#include "AdRead.h"
#include "rms.h"
#include "Harmonic.h"
#include "Power.h"
#include "GridFrequency.h"
#include "FPU.h"
#include "C28X_FPU_FASTRTS.h"
int16 Adiniflag=0; //AD开始初始化该标志为1,AD采样中为0
int16 Adiniover=0; //AD初始化结束标志
Uint16 N = 32; //32采样点数
float32 NNi = 0.0078125;
Uint16 MAX = 50;
int16 x1=0;
int A=0;
void ADdatadeal();
void Para_deal();
void Adinitial();
void FFtCaculate(RFFT_F32_STRUCT fft,float32 ipcb1[],float32 mag[],float32 Inbuffer[]);
#define Np 128
#define FFT_STAGES 7
float32 TwiddleBuffer[Np];
RFFT_F32_STRUCT fft32;
float32 sin_table[128],cos_table[128];
//ADREAD adread1 = ADREAD_DEFAULTS;
POWER power1 = POWER_DEFAULTS;
HARMONIC harmonic1 = HARMONIC_DEFAULTS;
RMS rms1 = RMS_DEFAULTS;
union Urms Urms1;
union Irms Irms1;
union Pmeas Pmeas1;
union UIgain Us,Is,Ig;
int16 Uab_flag=0;
int16 Ubc_flag=0;
int16 Uca_flag=0;
int16 Isa_flag=0;
int16 Isb_flag=0;
int16 Isc_flag=0;
int16 Ila_flag=0;
int16 Ilb_flag=0;
int16 Ilc_flag=0;
int16 Ica_flag=0;
int16 Icb_flag=0;
int16 Icc_flag=0;
float32 ipcbUab[Np];//实部,虚部
float32 ipcbUbc[Np];
float32 ipcbUca[Np];
float32 ipcbIsa[Np];
float32 ipcbIsb[Np];
float32 ipcbIsc[Np];
float32 ipcbIla[Np];
float32 ipcbIlb[Np];
float32 ipcbIlc[Np];
float32 magUab[Np/2];//幅值
float32 magUbc[Np/2];
float32 magUca[Np/2];
float32 magIsa[Np/2];
float32 magIsb[Np/2];
float32 magIsc[Np/2];
float32 magIla[Np/2];
float32 magIlb[Np/2];
float32 magIlc[Np/2];
float32 f_Uab[Np];//FFT输入
float32 f_Ubc[Np];
float32 f_Uca[Np];
float32 f_Isa[Np];
float32 f_Isb[Np];
float32 f_Isc[Np];
float32 f_Ila[Np];
float32 f_Ilb[Np];
float32 f_Ilc[Np];
void Para_deal()
{
unsigned int i;
for(i=0;i<128;i++)
{
sin_table[i]=3*sin(i/128.0*6.283185307179586476925286766559);
cos_table[i]=3*cos(i/128.0*6.283185307179586476925286766559);
if(i==127)
A=1;
}
/* if(Adiniflag==1)
Adinitial();
adread1.Ugain=Us.Kabcf; //变比
adread1.Isgain=Is.Kabcf;
adread1.Iggain=Ig.Kabcf;
ADdatadeal(&adread1);
rms1.N = Np;
rms1.Ni = NNi;
rms1.Uabp = adread1.Umeasabgrid; //实际值
//rms1.Ubcp = adread1.Umeasbcpt; //实际值
//rms1.Ucap = adread1.Umeascapt;
rms1.Ilap = adread1.ImeasIagrid1;
//rms1.Ilbp = adread1.ImeasIlbpt;
//rms1.Ilcp = adread1.ImeasIlcpt;
//rms1.Isap = adread1.ImeasIsapt;
// rms1.Isbp = adread1.ImeasIsbpt;
rms1.Iscp = adread1.ImeasIcgrid2;
rms1.Icap = adread1.ImeasIasvg1;
//rms1.Icbp = adread1.ImeasIcbpt;
//rms1.Iccp = adread1.ImeasIccpt;
rms_calc(&rms1);
// ——————————————————————————
if ((Uab_flag==1)&&(Ubc_flag==1)&&(Uca_flag==1)
&&(Isa_flag==1)&&(Isb_flag==1)&&(Isc_flag==1)
&&(Ila_flag==1)&&(Ila_flag==1)&&(Ila_flag==1))// If the samples are acquired */
if(A==1)
{
FFtCaculate(fft32,ipcbUab,magUab,sin_table);
FFtCaculate(fft32,ipcbUbc,magUbc,cos_table);
//FFtCaculate(fft32,ipcbUca,magUca,f_Uca);
// FFtCaculate(fft32,ipcbIsa,magIsa,f_Isa);
//FFtCaculate(fft32,ipcbIsa,magIsa,f_Isb);
//FFtCaculate(fft32,ipcbIsc,magIsc,f_Isc);
//FFtCaculate(fft32,ipcbIla,magIla,f_Ila);
//FFtCaculate(fft32,ipcbIlb,magIlb,f_Ilb);
//FFtCaculate(fft32,ipcbIlc,magIlc,f_Ilc);
A=0;
}
这是我写的程序