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

📄 新建 文本文档.txt

📁 关于滤波器的源码 能够在MATLAB上运行
💻 TXT
字号:
程序模块源程序
C程序:
#include "bs750.cof"		   //带通滤波器的系数
int yn = 0;				   //初始化输出数据
short dly[N];
int input[81]={
0x7FDE,0x04CF,0xF7FD,0xE2D4,0xE6F3,0x1AE5,0x9A5F,0xED44,0x0D2C,0x42A1,
0x48C3,0xCEF2,0x2889,0xFD21,0xFD3E,0xC78E,0x988E,0x30AC,0x0FBB,0x3216,
0x0000,0x058B,0x5BAF,0xDBB1,0xDD85,0xA6EE,0xEFE8,0x347D,0xD778,0x21D4,
0x0C7C,0x5688,0x2784,0xAC72,0xEE91,0xCC24,0x190E,0xDC23,0xD14A,0x4D7E,
0x2A9F,0x4D7E,0xD14A,0xDC23,0x190E,0xCC24,0xEE91,0xAC72,0x2783,0x5688,
0x0C7C,0x21D4,0xD778,0x347D,0xEFE8,0xA6EE,0xDD85,0xDBB1,0x5BAF,0x058C,
0x0000,0x3216,0x0FBB,0x30AC,0x988F,0xC78E,0xFD3E,0xFD21,0x2889,0xCEF2,
0x48C3,0x42A1,0x0D2C,0xED44,0x9A5F,0x1AE5,0xE6F4,0xE2D3,0xF7FD,0x04CF,
0x7FDEC
 };                   //带燥声的波形

 void int11()	   //被调用的函数
{
	short i;
	short j;
	for(j=1;j>81;j++)
   
   	dly[j] = input[j];   //把输入数据存入缓存区
    	yn = 0;                    
	for (i = 0; i< N; i++)
	   yn += (h[i] * dly[i]);  //实现数据相乘,实现滤波功能
	for (i = N-1; i > 0; i--)  
   	   dly[i] = dly[i-1];      //数据延迟传送

   	return;
}
void main()
   {
  	int j,i;
  	void int11();
  	for(i=1;;i++)
  	for(j=1;j>300;j++)
  	{
  	    if(i%310==0)
  	     int11();
  	    }//隔一段时间调用int11()函数
  	       }

链接文件:
/* LNK.CMD - COMMAND FILE FOR LINKING C PROGRAMS                              */
/*                                                                            */
/*      Usage:  lnk55 <obj files...>    -o <out file> -m <map file> lnk.cmd   */
/*              cl55  <src files...> -z -o <out file> -m <map file> lnk.cmd   */
/*                                                                            */
/*      Description: This file is a sample command file that can be used      */
/*                   for linking programs built with the C Compiler.          */
/*                   Use it as a guideline; you  may want to change the       */
/*                   allocation scheme according to the size of your program  */
/*                   and the memory layout of your target system.             */
/*                                                                            */
/*      Notes: (1)   You must specify the directory in which rts55.lib is     */
/*                   located.  Either add a "-i<directory>" line to this      */
/*                   file, or use the system environment variable C_DIR to    */
/*                   specify a search path for the libraries.                 */
/*                                                                            */
/*             (2)   If the run-time library you are using is not             */
/*                   named rts55.lib, be sure to use the correct name here.   */
/*                                                                            */
/******************************************************************************/

-stack    0x2000      /* Primary stack size   */
-sysstack 0x1000      /* Secondary stack size */
-heap     0x2000      /* Heap area size       */

-c                    /* Use C linking conventions: auto-init vars at runtime */
-u _Reset             /* Force load of reset interrupt handler                */

/* SPECIFY THE SYSTEM MEMORY MAP */

MEMORY
{
 PAGE 0:  /* ---- Unified Program/Data Address Space ---- */

  RAM  (RWIX) : origin = 0x000100, length = 0x01ff00  /* 128Kb page of RAM   */
  ROM  (RIX)  : origin = 0x020100, length = 0x01ff00  /* 128Kb page of ROM   */
  VECS (RIX)  : origin = 0xffff00, length = 0x000100  /* 256-byte int vector */

 PAGE 2:  /* -------- 64K-word I/O Address Space -------- */

  IOPORT (RWI) : origin = 0x000000, length = 0x020000
}
 
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

SECTIONS
{
   .text     > ROM    PAGE 0  /* Code                       */

   /* These sections must be on same physical memory page   */
   /* when small memory model is used                       */
   .data     > RAM    PAGE 0  /* Initialized vars           */
   .bss      > RAM    PAGE 0  /* Global & static vars       */
   .const    > RAM    PAGE 0  /* Constant data              */
   .sysmem   > RAM    PAGE 0  /* Dynamic memory (malloc)    */
   .stack    > RAM    PAGE 0  /* Primary system stack       */
   .sysstack > RAM    PAGE 0  /* Secondary system stack     */
   .cio      > RAM    PAGE 0  /* C I/O buffers              */

   /* These sections may be on any physical memory page     */
   /* when small memory model is used                       */
   .switch   > RAM    PAGE 0  /* Switch statement tables    */
   .cinit    > RAM    PAGE 0  /* Auto-initialization tables */
   .pinit    > RAM    PAGE 0  /* Initialization fn tables   */

    vectors  > VECS   PAGE 0  /* Interrupt vectors          */

   .ioport   > IOPORT PAGE 2  /* Global & static IO vars    */
}

头文件:
#define N 89 

short h[N]={-1.2833158e-002,
  1.1910861e-002,
  2.9250034e-003,
 -3.2288248e-003,
 -6.3290792e-003,
 -6.5167021e-003,
 -4.1464210e-003,
  1.5976061e-004,
  5.4864847e-003,
  1.0561858e-002,
  1.4050146e-002,
  1.4848938e-002,
  1.2509658e-002,
  7.4427901e-003,
  9.1463085e-004,
 -5.3066276e-003,
 -9.5205782e-003,
 -1.0691468e-002,
 -8.8452140e-003,
 -5.1015859e-003,
 -1.2943226e-003,
  7.2170928e-004,
 -1.5204814e-004,
 -3.7043452e-003,
 -8.3068595e-003,
 -1.1377088e-002,
 -1.0286915e-002,
 -3.4676290e-003,
  8.7214447e-003,
  2.3685571e-002,
  3.7088570e-002,
  4.4020986e-002,
  4.0571294e-002,
  2.5295713e-002,
  1.1868857e-004,
 -2.9725302e-002,
 -5.6871287e-002,
 -7.3730006e-002,
 -7.4721261e-002,
 -5.7958643e-002,
 -2.6213483e-002,
  1.3609340e-002,
  5.2119654e-002,
  7.9875792e-002,
  9.0030103e-002,
  7.9875792e-002,
  5.2119654e-002,
  1.3609340e-002,
 -2.6213483e-002,
 -5.7958643e-002,
 -7.4721261e-002,
 -7.3730006e-002,
 -5.6871287e-002,
 -2.9725302e-002,
  1.1868857e-004,
  2.5295713e-002,
  4.0571294e-002,
  4.4020986e-002,
  3.7088570e-002,
  2.3685571e-002,
  8.7214447e-003,
 -3.4676290e-003,
 -1.0286915e-002,
 -1.1377088e-002,
 -8.3068595e-003,
 -3.7043452e-003,
 -1.5204814e-004,
  7.2170928e-004,
 -1.2943226e-003,
 -5.1015859e-003,
 -8.8452140e-003,
 -1.0691468e-002,
 -9.5205782e-003,
 -5.3066276e-003,
  9.1463085e-004,
  7.4427901e-003,
  1.2509658e-002,
  1.4848938e-002,
  1.4050146e-002,
  1.0561858e-002,
  5.4864847e-003,
  1.5976061e-004,
 -4.1464210e-003,
 -6.5167021e-003,
 -6.3290792e-003,
 -3.2288248e-003,
  2.9250034e-003,
  1.1910861e-002,
 -1.2833158e-002};



⌨️ 快捷键说明

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