3025|0

1

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

用CCS的fft库软件仿真计算频谱的简单问题 [复制链接]

 很简单的问题,求指导:
我们产生一个sin函数,想对它做fft得到频谱
但产生的时域波形和频域波形都不对,是cmd文件有错?
还是sin函数不能直接生成,需要外部数据导入?
还是数据的long,int类型不对?
c文件如下:
#include "fft.h"
#define PI 3.141592653
#define N 128
#pragma DATA_SECTION(ipcb, "FFTipcb");
#pragma DATA_SECTION(mag, "FFTmag");
CFFT32 fft=CFFT32_128P_DEFAULTS;
long ipcb[2*N]; /* In place computation buffer */
long mag[N]; /* Magnitude buffer */
void MakeWave()
{
 int i;  
 for(i=0;i<128;i++)
  ipcb=(long)(0x2000*sin(PI*i*2*1000/16000));
}
void main()
{ /* FFT initialization */
fft.ipcbptr=ipcb; /* FFT computation buffer */
fft.magptr=mag; /* Store mag. square in separate buff */
fft.init(&fft); /* Twiddle factor pointer initialization */
/* Acquire samples in bit reversed order or Bit-reverse the in-order data using bit-rev utility */
/* FFT Computation */
MakeWave();
CFFT32_brev2(ipcb, ipcb, N);
fft.izero(&fft); /* Zero the imaginary part */
fft.calc(&fft); /* Compute the FFT */
fft.mag(&fft); /* Obtain the magnitude square */
}
cmd文件如下:
MEMORY
{
  PAGE 0 : NVMEM : origin = 0x3f8000, length = 0x0F00

   

  PAGE 1 : L0L1RAM : origin = 0x008000,length = 0x1000

}
 
SECTIONS
{
  FFTipcb ALIGN(512) : {} > L0L1RAM PAGE 1 
  FFTmag > L0L1RAM PAGE 1 
  FFTtf > NVMEM PAGE 0 /* Non volatile memory */
  .econst >NVMEM PAGE 0 /* Non volatile memory */

}
点赞 关注
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表