⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f2812.fft.asm.c

📁 利用汇编语言和TMS320F2812芯片实现FFT的算法
💻 C
字号:


#include "DSP28_Device.h"       /*DSP28xx Headerfile Include File*/
#include "DSP281x_Examples.h"     /* DSP28xx Examples Include File*/
#include "fft.h"
#include "math.h"

#define FFTN256 128
#define f 10
#define pi 3.1415926
#pragma DATA_SECTION(ipcb, "FFTipcb");

#pragma DATA_SECTION(mag, "FFTmag");/* Prototype statements for functions found within this file.
                                  Global variables used in this example*/
RFFT32 fft=RFFT32_128P_DEFAULTS;
long ipcb[FFTN256+2];                      /*in place computation buffer*/
long mag[FFTN256/2+1];                     /*magnitude buffer*/
const long win[FFTN256/2]=HANNING128;      /*window coefficent array*/
int m=0;
long n;
long p, q;
unsigned int mod[256];

main()
{
  Uint16 i;
  for(i=0;i<FFTN256;i++)
  {
   ipcb[i]= (long)(10000000*sin((2*pi*i)/12));
  
  }

   /*initialize FFT module */
   fft.ipcbptr=ipcb;                       /* FFT computation buffer pointer*/
   fft.magptr=ipcb;                       /*store back the mag.square in*/
   fft.winptr=(long *)win;                 /* window coefficient array*/
   fft.init(&fft);                         /*copy twiddle factor*/

   RFFT32_brev(ipcb,ipcb,FFTN256);
   fft.win(&fft);                          /*window the input data*/
   fft.calc(&fft);                         /*zero the imaginary part*/
   fft.split(&fft);                        /*compute the FFT*/
   fft.mag(&fft);                          /*obtain the magnitude square*/
   m=0;
   for(i=0;i<256;i+=2)
   {
    p=ipcb[i];
    q=ipcb[i+1];
    n=p*p+q*q;
    n=sqrt(n);
    mod[m]=n;
    m++;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -