程序是用C语言写的,主要作用是读入一组matlab生成的数据,然后再在DSP上做一个滤波
相关程序代码如下
C算法
- #include "stdio.h"
- #include "fdacoefs.h"
- //fdacoefs.h为 Matlab生成的系数表头文件
- #define N 81 //FIR滤波器的级数+1,本例中滤波器级数为 80
- #define LEN 200 //待滤波的数据长度
- long yn;
- int input[LEN]; //输入缓冲,在仿真时将从内存载入
- int output[LEN]; //输出缓冲,直接存放在内存中
- void main()
- {
- int i,j;
- int *x;
- for(j=0;j
- {
- x=&input[j];
- yn = 0;
- for(i=0; i
- yn += B[i]*(*x++);
- output[j]=yn>>15;
- }
- while(1);
- }
复制代码CMD文件
- MEMORY
- {
- PAGE 0: EPROG: origin = 0x1400, len = 0x7c00
- VECT: origin = 0xff80, len = 0x80
- PAGE 1: USERREGS: origin = 0x60, len = 0x1c
- BIOSREGS: origin = 0x7c, len = 0x4
- IDATA: origin = 0x80, len = 0x1380
- EDATA: origin = 0x1400, len = 0x8000
- EDATA1: origin = 0x9400, len = 0x4c00
- }
- SECTIONS
- {
- .vectors: {} > VECT PAGE 0
- .sysregs: {} > BIOSREGS PAGE 1
- .trcinit: {} > EPROG PAGE 0
- .gblinit: {} > EPROG PAGE 0
- frt: {} > EPROG PAGE 0
- .text: {} > EPROG PAGE 0
- .cinit: {} > EPROG PAGE 0
- .pinit: {} > EPROG PAGE 0
- .sysinit: {} > EPROG PAGE 0
- .bss: {} > IDATA PAGE 1
- .far: {} > IDATA PAGE 1
- .const: {} > IDATA PAGE 1
- .switch: {} > IDATA PAGE 1
- .sysmem: {} > IDATA PAGE 1
- .cio: {} > IDATA PAGE 1
- .MEM$obj: {} > IDATA PAGE 1
- .sysheap: {} > IDATA PAGE 1
- .stack: {} > IDATA PAGE 1
- }
复制代码
此帖出自
小平头技术问答
一周热门 更多>