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

📄 iir32d.c

📁 iir滤波器
💻 C
字号:
/* ==============================================================================

System Name:  IIR Filter Demo, This system uses IIR5BIQ32 (32 bit implementation) module

File Name: IIR32D.C

Description:    Primary System file for demonstrating the IIR Filter

Originator:     Digital control systems Group - Texas Instruments

Target dependency:  x2407/x241/2/3

Description:
============

This software demonstrates the IIR Filter Usage

   The frame work, for demonstrating the FILTER is given below
   
   
   CH0  |--------------|           |------------|               |-----------|
   ---->|              |           |            |               |           |
   CH0  |              |           |            |               |           |         
   ---->|              |     input |            | Output        |  EVMDAC   |
   CH0  |   ADC04U_DRV |-----|---->|    IIR     |-------------->|  PWMDAC   |
   ---->|              |     |     |   FILTER   |               |  DATALOG  |
   CH0  |              |     |     |            |          |--->|           |
   --|->|              |     |     |            |          |    |           |
        |--------------|     |     |------------|          |    |-----------|
                             |                             |
                             |-----------------------------|
 
*/

#include "sgen.h"
#include "dlog4ch.h"
#include "filter.h"

/* Create an instance of Signal generator module    */
SGENTI_1 sgen = SGENTI_1_DEFAULTS;

/* Create an instance of DATALOG Module             */
DLOG_4CH dlog=DLOG_4CH_DEFAULTS;      
    
/* Create an Instance of IIR5BIQD32 module and place the object in "iirfilt" section    */ 
#pragma DATA_SECTION(iir, "iirfilt");
IIR5BIQ32  iir=IIR5BIQ32_DEFAULTS;

/* =============================================================================
Modify the delay buffer size to comensurate with the no of biquads in the filter
Size of the Delay buffer=4*nbiq
==============================================================================*/ 
/* Define the Delay buffer for the cascaded 6 biquad IIR filter and place it in "iirfilt" section */
#pragma DATA_SECTION(dbuffer,"iirfilt");
long dbuffer[2*IIR32_LPF_NBIQ];


/* Define Constant Co-efficient Array  and place the
.constant section in ROM memory				*/ 
const long coeff[5*IIR32_LPF_NBIQ]=IIR32_LPF_COEFF;
/*long f00n[1000]={    0,286,572,857,1143,             		            
                	1428,1713,1997,2280,2563,
                	2845,3126,3406,3686,3964,
                	4240,4516,4790,5063,5334,
                	5604,5872,6138,6402,6664,
                	6924,7182,7438,7692,7943,
                	8192,8438,8682,8923,9162,
                	9397,9630,9860,10087,10311,
                	10531,10749,10963,11174,11381,
                	11585,11786,11982,12176,12365,
                	12551,12733,12911,13085,13255,
                	13421,13583,13741,13894,14044,
                	14189,14330,14466,14598,14726,
                	14849,14968,15082,15191,15296,
                	15396,15491,15582,15668,15749,
                	15826,15897,15964,16026,16083,
                	16135,16182,16225,16262,16294,
                	16322,16344,16362,16374,16382,
                
                   16384,16382,16374,16362,16344,      
                   16322,16294,16262,16225,16182,
		   16135,16083,16026,15964,15897,
		   15826,15749,15668,15582,15491,
		   15396,15296,15191,15082,14968,    
		   14849,14726,14598,14466,14330,
		  14189,14044,13894,13741,13583,
		  13421,13255,13085,12911,12733,
		  12551,12365,12176,11982,11786,
		  11585,11381,11174,10963,10749,
		   10531,10311,10087,9860,9630,
		   9397,9162,8923,8682,8438,
		   8192,7943,7692,7438,7182,
                	6924,6664,6402,6138,5872,
                	5604,5334,5063,4790,4516,
                	4240,3964,3686,3406,3126,
                	2845,2563,2280,1997,1713,
                	1428,1143,857,572,286,

	        	0,65250,64964,64679,64393,		
                	64108,63823,63539,63256,62973,
                	62691,62410,62130,61850,61572,
                	61296,61020,60746,60473,60202,
                	59932,59664,59398,59134,58872,
                	58612,58354,58098,57844,57593,
                	57344,57098,56854,56613,56374,
                	56139,55906,55676,55449,55225,
                	55005,54787,54573,54362,54155,
                	53951,53750,53554,53360,53171,
                	52985,52803,52625,52451,52281,
                	52115,51953,51795,51642,51492,
                	51347,51206,51070,50938,50810,
                   50687,50568,50454,50345,50240,
                	50140,50045,49954,49868,49787,
                	49710,49639,49572,49510,49453,
                	49401,49354,49311,49274,49242,
                	49214,49192,49174,49162,49154,

                	//49152,49154,49162,49174,49192,
                	49000,50000,49000,50000,49000,	
                	49214,49242,49274,49311,49354,
                	49401,49453,49510,49572,49639,
                	49710,49787,49868,49954,50045,
                	50140,50240,50345,50454,50568,
                   50687,50810,50938,51070,51206,
                	51347,51492,51642,51795,51953,
                	52115,52281,52451,52625,52803,
                	52985,53171,53360,53554,53750,
                	53951,54155,54362,54573,54787,
                	55005,55225,55449,55676,55906,
                	56139,56374,56613,56854,57098,
                	57344,57593,57844,58098,58354,
                	58612,58872,59134,59398,59664,
                	59932,60202,60473,60746,61020,
                	61296,61572,61850,62130,62410,
                	62691,62973,63256,63539,63823,
                	64108,64393,64679,64964,65250, };   */
long f00n[1000]={    0,286,572,857,1143,             		            
                	1428,1713,1997,2280,2563,
                	2845,3126,3406,3686,3964,
                	4240,4516,4790,5063,5334,
                	5604,5872,6138,6402,6664,
                	6924,7182,7438,7692,7943,
                	8192,8438,8682,8923,9162,
                	9397,9630,9860,10087,10311,
                	10531,10749,10963,11174,11381,
                	11585,11786,11982,12176,12365,
                	12551,12733,12911,13085,13255,
                	13421,13583,13741,13894,14044,
                	14189,14330,14466,14598,14726,
                	14849,14968,15082,15191,15296,
                	15396,15491,15582,15668,15749,
                	15826,15897,15964,16026,16083,
                	16135,16182,16225,16262,16294,
                	17322,15344,17362,15374,17382,
                
                   16384,16382,16374,16362,16344,      
                   16322,16294,16262,16225,16182,
		   16135,16083,16026,15964,15897,
		   15826,15749,15668,15582,15491,
		   15396,15296,15191,15082,14968,    
		   14849,14726,14598,14466,14330,
		  14189,14044,13894,13741,13583,
		  13421,13255,13085,12911,12733,
		  12551,12365,12176,11982,11786,
		  11585,11381,11174,10963,10749,
		   10531,10311,10087,9860,9630,
		   9397,9162,8923,8682,8438,
		   8192,7943,7692,7438,7182,
                	6924,6664,6402,6138,5872,
                	5604,5334,5063,4790,4516,
                	4240,3964,3686,3406,3126,
                	2845,2563,2280,1997,1713,
                	1428,1143,857,572,286,

	        	0,65250,64964,64679,64393,		
                	65108,64823,64539,62256,61973,
                	62691,62410,62130,61850,61572,
                	61296,61020,60746,60473,60202,
                	59932,59664,59398,59134,58872,
                	58612,58354,58098,57844,57593,
                	57344,57098,56854,56613,56374,
                	56139,55906,55676,55449,55225,
                	55005,54787,54573,54362,54155,
                	53951,53750,53554,53360,53171,
                	52985,52803,52625,52451,52281,
                	52115,51953,51795,51642,51492,
                	51347,51206,51070,50938,50810,
                   50687,50568,50454,50345,50240,
                	50140,50045,49954,49868,49787,
                	49710,49639,49572,49510,49453,
                	49401,49354,49311,49274,49242,
                	49214,49192,49174,49162,49154,

                	//49152,49154,49162,49174,49192,
                	49000,50000,49000,50000,49000,	
                	49214,49242,49274,49311,49354,
                	49401,49453,49510,49572,49639,
                	49710,49787,49868,49954,50045,
                	50140,50240,50345,50454,50568,
                   50687,50810,50938,51070,51206,
                	51347,51492,51642,51795,51953,
                	52115,52281,52451,52625,52803,
                	52985,53171,53360,53554,53750,
                	53951,54155,54362,54573,54787,
                	55005,55225,55449,55676,55906,
                	56139,56374,56613,56854,57098,
                	57344,57593,57844,58098,58354,
                	58612,58872,59134,59398,59664,
                	59932,60202,60473,60746,61020,
                	61296,61572,61850,62130,62410,
                	62691,62973,63256,63539,63823,
                	64108,64393,64679,64964,65250, };       
int  i=0;         
/* Finter Input and Output Variables                */   
int xn,yn;
     
void main()
{    
        

              

/*---------------------------------------------------------------------------
    Nothing running in the background at present           
----------------------------------------------------------------------------*/

        while(1) 
        {
          //  sgen.calc(&sgen);
		//	f00n[i++]=sgen.out;
            xn=f00n[i++];
		if(i>=360)i=0;
            iir.input=xn;           
            iir.calc(&iir);
            yn=iir.output16;
            dlog.update(&dlog);
        }       

} /* End: main() */

             




⌨️ 快捷键说明

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