资源简介
里面含有数十个C语言程序,基于C6711和C6200系列DSP,对于DSP初学者而言,无疑提供了一条捷径
代码片段和文件信息
//AdaptIDFIR.c Adaptive FIR for system ID of an FIR (uses C67 tools)
#include “bp55.cof“ //fixed FIR filter coefficients
#include “noise_gen.h“ //support noise generation file
#define beta 1E-13 //rate of convergence
#define WLENGTH 60 //# of coefffor adaptive FIR
float w[WLENGTH+1]; //buffer coeff for adaptive FIR
int dly_adapt[WLENGTH+1]; //buffer samples of adaptive FIR
int dly_fix[N+1]; //buffer samples of fixed FIR
short out_type = 1; //output for adaptive/fixed FIR
int fb; //feedback variable
shift_reg sreg; //shift register
int prand(void) //pseudo-random sequence {-11}
{
int prnseq;
if(sreg.bt.b0)
prnseq = -8000; //scaled negative noise level
else
prnseq = 8000; //scaled positive noise level
fb =(sreg.bt.b0)^(sreg.bt.b1); //XOR bits 01
fb^=(sreg.bt.b11)^(sreg.bt.b13); //with bits 1113 -> fb
sreg.regval<<=1;
sreg.bt.b0=fb; //close feedback path
return prnseq; //return noise sequence
}
interrupt void c_int11() //ISR
{
int i;
int fir_out = 0; //init output of fixed FIR
int adaptfir_out = 0; //init output of adapt FIR
float E; //error=diff of fixed/adapt out
dly_fix[0] = prand(); //input noise to fixed FIR
dly_adapt[0]=dly_fix[0]; //as well as to adaptive FIR
for (i = N-1; i>= 0; i--)
{
fir_out +=(h[i]*dly_fix[i]); //fixed FIR filter output
dly_fix[i+1] = dly_fix[i]; //update samples of fixed FIR
}
for (i = 0; i < WLENGTH; i++)
adaptfir_out +=(w[i]*dly_adapt[i]); //adaptive FIR filter output
E = fir_out - adaptfir_out; //error signal
for (i = WLENGTH-1; i >= 0; i--)
{
w[i] = w[i]+(beta*E*dly_adapt[i]); //update weights of adaptive FIR
dly_adapt[i+1] = dly_adapt[i]; //update samples of adaptive FIR
}
if (out_type == 1) //slider position for adapt FIR
output_sample(adaptfir_out); //output of adaptive FIR filter
else if (out_type == 2) //slider position for fixed FIR
output_sample(fir_out); //output of fixed FIR filter
return;
}
void main()
{
int T=0 i=0;
for (i = 0; i < WLENGTH; i++)
{
w[i] = 0.0; //init coeff for adaptive FIR
dly_adapt[i] = 0; //init buffer for adaptive FIR
}
for (T = 0; T < N; T++)
dly_fix[T] = 0; //init buffer for fixed FIR
sreg.regval=0xFFFF; //initial seed value
fb = 1; //initial feevack value
comm_intr(); //init DSK codec McBSP
while (1); //infinite loop
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1684 1998-01-12 07:04 C_program\Adaptc\ADAPTC.C
文件 32078 1998-01-12 07:05 C_program\Adaptc\ADAPTC.EXE
文件 1040 2001-08-25 14:57 C_program\Adaptc\DESIRED
文件 1040 2001-08-25 14:57 C_program\Adaptc\ERROR
文件 1040 2001-08-25 14:57 C_program\Adaptc\Y_OUT
文件 2975 2001-07-21 08:09 C_program\AdaptIDFIR\adaptIDFIR.c
文件 233 2001-05-13 05:50 C_program\AdaptIDFIR\adaptIDFIR.gel
文件 18146 2001-08-21 18:52 C_program\AdaptIDFIR\AdaptIDFIR.out
文件 893 2001-08-21 18:54 C_program\AdaptIDFIR\AdaptIDFIR.pjt
文件 1006 2001-05-04 20:20 C_program\AdaptIDFIR\bp55.COF
文件 923 2001-05-05 00:40 C_program\AdaptIDFIR\BS55.COF
文件 3414 2001-08-21 18:52 C_program\AdaptIDFIR\cc_build_Debug.log
文件 925 2001-01-14 22:09 C_program\AdaptIDFIR\LP55.COF
文件 403 2001-04-20 00:39 C_program\AdaptIDFIR\Noise_gen.h
文件 2985 2001-05-12 21:55 C_program\adaptidFIRw\adaptIDFIRW.c
文件 18565 2001-08-21 22:41 C_program\adaptidFIRw\AdaptIDFIRw.out
文件 926 2001-08-22 01:13 C_program\adaptidFIRw\AdaptIDFIRw.pjt
文件 1014 2001-05-12 21:57 C_program\adaptidFIRw\bp3000.COF
文件 1006 2001-05-13 05:50 C_program\adaptidFIRw\bp55.COF
文件 3427 2001-08-21 22:41 C_program\adaptidFIRw\cc_build_Debug.log
文件 403 2001-05-13 05:51 C_program\adaptidFIRw\Noise_gen.h
文件 3327 2001-07-21 20:22 C_program\AdaptIDIIR\AdaptIDIIR.c
文件 233 2001-05-08 18:15 C_program\AdaptIDIIR\adaptIDIIR.gel
文件 18596 2001-08-22 05:41 C_program\AdaptIDIIR\AdaptIDIIR.out
文件 893 2001-08-22 05:42 C_program\AdaptIDIIR\AdaptIDIIR.pjt
文件 1344 2001-05-06 06:28 C_program\AdaptIDIIR\bp2000.cof
文件 3414 2001-08-22 05:41 C_program\AdaptIDIIR\cc_build_Debug.log
文件 626 2001-05-06 06:32 C_program\AdaptIDIIR\lp2000.cof
文件 403 2001-04-20 00:39 C_program\AdaptIDIIR\Noise_gen.h
文件 2347 2001-08-21 18:41 C_program\Adaptnoise\Adaptnoise.c
............此处省略522个文件信息
- 上一篇:MFC示波器实现代码
- 下一篇:c++写的fcm算法程序
评论
共有 条评论