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

📄 iir.c

📁 IIR数字滤波器设计。其中涉及到Matlab软件中IIR的参数设计及CCS中的软件仿真及硬件仿真程序
💻 C
字号:
/*****************************************************************************/
/* Codec.c
/* 
/* Digital Loopback example
/*
/*****************************************************************************/

#include <type.h>
#include <board.h>
#include <codec.h>
#include <mcbsp54.h>

#include <math.h>
#include <stdio.h>
#include <tms320.h>
#include <dsplib.h>

#define  NX    1024
#define  NBIQ 5
#define  pi    3.1415926

DATA 	x[NX];
DATA    r[NX];
float  y[NX];

float   coff[5*NBIQ]={
  /*  0.1035 ,  -0.2067  ,  0.1032   ,  -0.4109 ,   0.4855,
    0.0801 ,   0.1594  ,  0.0793 ,     0.1419 ,   0.4842,
    0.4044 ,  -0.8048  ,  0.4004 ,    -0.3537 ,   0.4589,
    0.1540 ,   0.3075  ,  0.1536 ,     0.0841 ,   0.4561,
    0.2939 ,  -0.5899  ,  0.2960 ,    -0.2582 ,   0.4387,
    0.1603 ,   0.3216  ,  0.1614 ,    -0.0155 ,   0.4364,
    0.2155 ,   0.0000  , -0.2179 ,    -0.1379 ,   0.4300      //a/2 b/1 4000-6000 ,51,best
  */
    0.0003 ,   0.0006  ,  0.0003 ,  -0.9499  ,  0.4904,
    0.0101 ,   0.0198  ,  0.0098 ,  -0.9415  ,  0.4727,
    0.0119 ,   0.0239  ,  0.0120 ,    -0.9407,    0.4585,
    0.0429 ,   0.0878  ,  0.0449 ,   -0.9432 ,   0.4493,
    0.1466  ,  0.1510  ,       0 ,  -0.4723  ,       0
  //0--2k,44k
                   };

#pragma DATA_SECTION (h,".coefficient")
DATA    h[5*NBIQ];
#pragma DATA_SECTION (dbuffer,".dbuffer")
DATA    dbuffer[4*NBIQ];
DATA    *dp=dbuffer;
/*****************************************************************************/
/* Function Prototypes
/*****************************************************************************/

/* This delay routine does not conflict with DSP/BIOS.  It is used in this  */
/* example rather than brd_delay_msec which causes DSP/BIOS conflicts just  */
/* because of this.  If you are not using DSP/BIOS, you can change the code */
/* to use brd_delay_msec.                                                   */

void delay(s16 period);


/*****************************************************************************/
/* Global Variables                                                          */
/*****************************************************************************/

HANDLE hHandset;
s16 data;


/*****************************************************************************/
/* MAIN
/*****************************************************************************/

void main()
{
    
    short i;
    short oflag=0;
    float t=1;
    
   fltoq15(coff,h,5*NBIQ);
    
   for (i=0;i<NX;i++) r[i] =0;	// clear output buffer (optional)
  	for (i=0; i<4*NBIQ; i++) dbuffer[i] = 0; // clear delay buffer (a must)
    dp= &dbuffer[0]; 
    
    /* Polling and digital loopback */
       for(;;)
       {
             
       		for(i=0;i<NX;i++)
       		{
         		y[i]=sin(2*pi*200*i/44000);
       		}
      		fltoq15(y,x,NX);
      		for(i=0;i<NX;i++)
      		{
      			x[i]/=2;
      		}	
      		oflag=iircas51(x,h,r,&dp,NBIQ, NX);
      		for(i=0;i<NX;i++)
      		{
      			r[i]*=1;
      		}	
       }   
 }          


⌨️ 快捷键说明

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