设为首页收藏本站 IC币充值

IC设计小镇

 找回密码
 入住IC小镇

QQ登录

只需一步,快速开始

IC设计外包
芯满微
查看: 852|回复: 0

[转贴] DSP28 fir低通滤波器的设计源码

[复制链接]
发表于 2019-2-9 19:50:02 | 显示全部楼层 |阅读模式
  1. #include"stdio.h"
  2. #include"math.h"
  3. #include"DSP28_Device.h"
  4. #defineorder 26
  5. #defineN  128         
  6. #definepi 3.1415926
  7. floatFIR_LPF[order] ={-1.52864422149721e-05,-0.000133359311426970,-0.000544636220343477,-0.00137835208978255,-0.00218948983490142,-0.00124340086554490,0.00478134865608317,0.0198838342801837,0.0464361812966399,0.0825102845162328,0.120763491355644,0.150360916315540,0.161536936687780,0.150360916315540,0.120763491355644,0.0825102845162328,0.0464361812966399,0.0198838342801837,0.00478134865608317,-0.00124340086554490,-0.00218948983490142,-0.00137835208978255,-0.000544636220343477,-0.000133359311426970,-1.52864422149721e-05};
  8. floats;
  9. inti,n;
  10. floatinput[N],output[N];  
  11. intfs=10000;   
  12. intf1=600;   
  13. intf2=1500;
  14. #definefa 2*pi*f1/fs
  15. #definefb 2*pi*f2/fs
  16. void inputwave()
  17. {
  18.     for(n=0;n<N;n++ )
  19. input[n]=sin(fa*n)+sin(fb*n);
  20. }
  21. voidmain()
  22. {   int m=0,n=0;
  23.     inputwave();           
  24. for(n=0;n<N+order;n++)
  25. {
  26.   for(s=0,m=0;(m<order)&&(m<n);m++)
  27. {
  28.    s=FIR_LPF[m]*input[n-m]+s;
  29. }
  30.         output[n]=s;}
  31. while(1);  
复制代码


您需要登录后才可以回帖 登录 | 入住IC小镇

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|Archiver|手机版|IC设计小镇 ( 苏ICP备10008526号  

GMT+8, 2020-6-5 02:08 , Processed in 0.063145 second(s), 6 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表