📄 fft128c.c
字号:
/* ==============================================================================
System Name: Real FFT - Software Test Bench (STB)
File Name: FFTRD.C
Description: Primary System file for demonstrating the Real FFT module
Originator: Advanced Embeeded Control (AEC) - Texas Instruments
Target dependency: x28x
Description:
============
*/
#include "DSP281x_Device.h"
#include "fft.h"
#include "const.h"
#define N_FFT 8
/* Create an Instance of FFT module */
#define N 128
#pragma DATA_SECTION(ipcb, "FFTipcb");
#pragma DATA_SECTION(mag, "FFTmag");
CFFT32 fft=CFFT32_128P_DEFAULTS;
long ipcb[N_FFT][2*N];
long mag[N_FFT][N];
/* Define window Co-efficient Array and place the
.constant section in ROM memory */
const long win[N/2]=HAMMING128;
Uint16 fftflag=0; //FFT转换启动标志:0不启动;1:启动
extern Uint16 SampleTable[N_SAMPLE+1][N_ANALOG];
void fft_data()
{
Uint16 i,j;
if (fftflag==0)
{
for (i=0;i<N_FFT;i++)
for (j=0;j<N;j++)
{
ipcb[i][2*j]=((unsigned long)SampleTable[j][2*i])<<16;
}
fftflag=1;
}
}
void fft_subroutine()
{
Uint16 i;
if (fftflag==1) // If the samples are acquired
{
for (i=0;i<N_FFT;i++)
{
/* Initialize FFT module */
fft.ipcbptr=&ipcb[i][0];
fft.magptr=&mag[i][0];
fft.winptr=(long *)win;
fft.init(&fft);
{
CFFT32_brev2(&ipcb[i][0],&ipcb[i][0],N);
// CFFT32_brev2(&ipcb[i][0],&ipcb[i][0],N); // Input samples in Real Part
/* fft.win(&fft);
CFFT32_brev2(ipcb,ipcb,N);
CFFT32_brev2(ipcb,ipcb,N); // Input after windowing
*/
fft.izero(&fft);
fft.calc(&fft);
fft.mag(&fft);
}
}
fftflag=0; // Enable the next acquisition
GpioDataRegs.GPATOGGLE.bit.GPIOA15=1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -