第 8 章 数字信号处理典型算法程序设计

Click here to load reader

Upload: eliana-middleton

Post on 02-Jan-2016

114 views

Category:

Documents


7 download

DESCRIPTION

第 8 章 数字信号处理典型算法程序设计. 本章将要讲解通信与信号处理中常见的下列几种具有代表性的算法在 C54x 芯片中的具体实现方法: 卷积 有限冲激响应 (FIR) 数字滤波器 无限冲激响应 (IIR) 数字滤波器 快速傅立叶变换 (FFT). 第 8 章 数字信号处理典型算法程序设计. 目录: 8.1 卷积运算的 DSP 实现 8.2 数字滤波器的 DSP 实现 8.3 IIR 滤波器的 DSP 实现 8.4 快速傅立叶变换的 DSP 实现. 第 8 章 数字信号处理典型算法程序设计. 8.1 卷积运算的 DSP 实现. - PowerPoint PPT Presentation

TRANSCRIPT

PowerPoint Presentation

FIR: : FIR FIRS XmemYmemPmad PmadPAR (RC)0 ((Xmem)(Ymem))16A (B)(A(3216))PARB (PAR1)PAR (RC)1RC

*AR1+% 202 520N=5EFB550EFB=1000h20BKAR1 1000hAR1step = +1index19(13h)index = index + stepindexBK20index = index + step BKindex=0AR1=1000hEFB EOBEFB3.2.5 2 N208 8.1 DSP

8 8.1.1f(t)h(t)

f(t)h(t)8 8.1.2 1.

f(k)

8

12301238 2.

,

8 3. 8 8.1.3.C54x 1.C54xdsplib TIC54xDSPLIBCCSDSPLIB C 8 DSPLIB oflag = short convol (DATA *x, DATA *h, DATA *r, ushort nr, ushort nh)xhr

8 , 0 j nr x hxL+M-1hMnrL+M-1rM-1

12Each section can be convolved with the finite- length impulse response and output sections are fitted together in an appropriate way.Block ConvolutionIf the input signal is of indefinite duration, the input signal to be processed is segmented into sections of length L.The processing of each section can then be implemented using the DFT.

13Block Convolution

overlap-add method (1)Segment into sections of length L;

(2) fill 0 into and some section of , do() L+P-1 points FFT ;

(3) calculate 14

P-1 points(4)add the points n=0P-2 in yr[n] to the last P-1 points in the former section yr-1[n]the output for this section is the points n=0L-1

overlap-add method

L=16(1)Segment into sections of length L;

(2) fill 0 into and some section of , then do L+P-1 points FFT ;

(3) calculate

1415

Circular Convolution as Linear Convolution with Aliasing

input16

overlap-save method (4) the output for this section is L-P+1 points of y[n] n=P-1,L-1

(1) segment into sections of length L, overlap P-1 points;

(2) fill 0 into and some section of , then do L points FFT

(3) calculate

L=25L-P+1 P-1pointsP-1pointsP-1pointsP-1+L8 C#define Frame 240 //nr#define FilterLength 8 //nhfor(i=0;i VECT PAGE 0 fir_coff :> EPROGPAGE 0 fir_bfr :>IDATA1PAGE 1 fir_vars :>IDATA1PAGE 1STACK :> EDATAPAGE 1} 8 15FIR0.6CCSFIRCCSfir.pjtfir.asm,vectors.asm fir.cmdfir.pjtprojectrebuild all file load program fir.out DSP

8 MATLABCCS1clear allx(1:20)=0x(2:2:1000,:)=400x=x'x=x(:)fid1=fopen('rec.dat','wt')fprintf(fid1,'1651 1 0 0 0\n');% a1=fprintf(fid1,'%d\n',x)fclose(fid1)

8 MATLABCCS1clear allx(1:20)=0x(2:2:1000,:)=400x=x'x=x(:)fid1=fopen('rec.dat','wt')fprintf(fid1,'1651 1 0 0 0\n');% a1=fprintf(fid1,'%d\n',x)fclose(fid1)

CCS.dat 1651 1 3000 0 C8MagicNumber16511- 2- 3- 4- 0x3000 0- 1- 0xC8(200)8 MATLABCCS2)File->Data->LoadMatlab rec.dat

3)AddressinputLengthC8200dPagedata4), Run8 5 viewgraph/time frequence

8 5) viewgraph/time frequence

8 5) viewgraph/time frequence

8 5) viewgraph/time frequence

8 8.3 IIRDSP IIR 8.3.1 IIR1. IIRIIR

8 IIR M=Nz

8 IIR

IIR (1)I()(2)II()(3)()(4)(5)(lattice)

8 2. IIR1)IIR

IIRIIRIIR

8 IIIR

8 IIIR

8 IIIIR x(n)y(n)w(n)- a1- a2b1b2

b0

8 2)IIRIIR :

Hi(z) 107Direct Form II

x[n]y[n]w[n]b0b1b2bN-1bNa1a2aN-1aNz1z1z1

108 (Cascade Form)

109Cascade Form

2nd OrderSystem2nd OrderSystem2nd OrderSystem110Cascade Form

x[n]y[n]z1z1a11a21b11b21b01z1z1a12a22b12b22b02z1z1a13a23b13b23b03123Assume Ns=38 : x(n)y(n)Hk(z)H1(z)CH2(z)IIR :

8 IIR: H2 (z)x(n)y(n)H1(z)Hk(z)C8 :

:IIR

8 IIR: yi(n)yi-1(n)ei(n)ei-1(n)-kiki

18 3. IIR 1

2,

3 8

1

2:

8 sjz

sz

sz 8

c s/ cs 8 (1)(2) 8 (1)

(2)Ha(s),s/ cHa(s)sH(s) 8 (3)H(s)H(z)H(s)H(z)

(2)(3)8

8 8-1BW=1rad/sfs=100Hz

= BW=1 rad/sT=1/ fs=0.01s

c

8 s/ c

s z

8 8-1BW=1rad/sfs=100Hz

= BW=1rad/sT=1/ fs=0.01s

c

8 s/ c

s z

8 8.3.2 IIRC54x 1.1)butter

[b,a] = buttern,Wn [b,a] = buttern,Wn,ftype Wnn0Wn1Wn=10.5fs 8 ftype = highWn

ftype = stopWn = [ W1 W2]W1< W