基于DSP的快速傅立葉變換(FFT)的實(shí)現(xiàn)(匯編語(yǔ)言)_第1頁(yè)
基于DSP的快速傅立葉變換(FFT)的實(shí)現(xiàn)(匯編語(yǔ)言)_第2頁(yè)
基于DSP的快速傅立葉變換(FFT)的實(shí)現(xiàn)(匯編語(yǔ)言)_第3頁(yè)
基于DSP的快速傅立葉變換(FFT)的實(shí)現(xiàn)(匯編語(yǔ)言)_第4頁(yè)
基于DSP的快速傅立葉變換(FFT)的實(shí)現(xiàn)(匯編語(yǔ)言)_第5頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上快速傅立葉變換(FFT)的實(shí)現(xiàn)一、實(shí)驗(yàn)?zāi)康?.了解FFT的原理及算法;2.了解DSP中FFT的設(shè)計(jì)及編程方法;3.熟悉FFT的調(diào)試方法;二、實(shí)驗(yàn)原理FFT是一種高效實(shí)現(xiàn)離散付立葉變換的算法,把信號(hào)從時(shí)域變換到頻域,在頻域分析處理信息。對(duì)于長(zhǎng)度為N的有限長(zhǎng)序列x(n),它的離散傅里葉變換為: ,稱為旋轉(zhuǎn)因子,或蝶形因子。 在x(n)為復(fù)數(shù)序列的情況下,計(jì)算X(k): 對(duì)某個(gè)k值,需要N次復(fù)數(shù)乘法、(N-1)次復(fù)數(shù)加法;對(duì)所有N個(gè)k值,需要次復(fù)數(shù)乘法和N(N-1)次復(fù)數(shù)加法。對(duì)于N相當(dāng)大時(shí)(如1024)來(lái)說(shuō),直接計(jì)算它的DFT所作的計(jì)算量是很大的,F(xiàn)FT的基本思想在于:利

2、用的周期性即: 對(duì)稱性:將原有的N點(diǎn)序列分成兩個(gè)較短的序列,這些序列的DFT可以很簡(jiǎn)單的組合起來(lái)得到原序列的DFT。按時(shí)間抽取的FFTDIT FFT信號(hào)流圖如圖5.1所示:圖5.1 時(shí)間抽取的FFTDIT FFT信號(hào)流圖FFT算法主要分為以下四步。第一步 輸入數(shù)據(jù)的組合和位倒序把輸入序列作位倒序是為了在整個(gè)運(yùn)算最后的輸出中得到的序列是自然順序。第二步 實(shí)現(xiàn)N點(diǎn)復(fù)數(shù)FFT 第一級(jí)蝶形運(yùn)算;第二級(jí)蝶形運(yùn)算;第三級(jí)至log2N級(jí)蝶形運(yùn)算;FFT運(yùn)算中的旋轉(zhuǎn)因子是一個(gè)復(fù)數(shù),可表示: 為了實(shí)現(xiàn)旋轉(zhuǎn)因子的運(yùn)算,在存儲(chǔ)空間分別建立正弦表和余弦表,每個(gè)表對(duì)應(yīng)從0度到180度,采用循環(huán)尋址來(lái)對(duì)正弦表和余弦表進(jìn)行

3、尋址。 第三步 功率譜的計(jì)算 X(k)是由實(shí)部和虛部組成的復(fù)數(shù):;計(jì)算功率譜時(shí)只需將FFT變換好的數(shù)據(jù),按照實(shí)部和虛部求它們的平方和,然后對(duì)平方和進(jìn)行開平方運(yùn)算。 第四步 輸出FFT結(jié)果。三、實(shí)驗(yàn)內(nèi)容與步驟. 本實(shí)驗(yàn)要求使用FFT變換求一個(gè)時(shí)域信號(hào)的頻域特性,并從這個(gè)頻域特性求出該信號(hào)的頻率值,然后使用DSP匯編語(yǔ)言對(duì)FFT的DSP編程。. 將計(jì)算機(jī)與DES-320PPA教學(xué)實(shí)驗(yàn)系統(tǒng)連接好,打開實(shí)驗(yàn)箱電源,然后運(yùn)行CCS軟件。2.新建fft.pjt工程文件,并輸入FFT的DSP程序及命令鏈接文件。如下:*Radix-2,DIT,Real-input FFT Program * fft.asm

4、*.mmregs.global reset,start,sav_sin,sav_idx,sav_grp .def start,_c_int00 .data DATA.space1024 .copy "fft.inc" N.set128LOGN.set7 sav_grp.usect"tempv",3sav_sin.setsav_grp+1sav_idx.setsav_grp+2OUTPUT.usect"OUTPUT",256BOS.usect"stack",0FhTOS.usect"stack",

5、1 .copy "twiddle1.inc" .copy "twiddle2.inc".text_c_int00b start nopnopstart:STM#TOS,SPLD#0,DPSSBXFRCT STM #2*N,BK STM#INPUT,AR3STM#DATA,AR7MVMMAR7,AR2STM#N-1,BRCRPTBDplend-1STM #N,AR0LDM AR3,A READA *AR2+ ADD #1,AREADA *AR2+MAR*AR3+0Bplend:STM#0,BKLD#-1,ASMMVMMAR7,AR2STM#DATA+2,A

6、R3STM #N/2-1,BRCLD*AR2,16,ARPTBDs1end-1STM#3,AR0SUB*AR3,16,A,BADD*AR3,16,ASTHA,ASM,*AR2+STB,*AR3+|LD*AR2,ASUB*AR3,16,A,BADD*AR3,16,ASTHA,ASM,*AR2+0STB,*AR3+0%|LD*AR2,As1end:MVMMAR7,AR2STM#DATA+4,AR3STM#N/4-1,BRCLD*AR2,16,ARPTBDs2end-1STM#5,AR0SUB*AR3,16,A,BADD*AR3,16,ASTHA,ASM,*AR2+STB,*AR3+|LD*AR2,

7、ASUB*AR3,16,A,BADD*AR3,16,ASTHA,ASM,*AR2+STHB,ASM,*AR3+MAR*AR3+ADD*AR2,*AR3,ASUB*AR2,*AR3-,BSTHA,ASM,*AR2+SUB*AR2,*AR3,ASTB,*AR3|LD*AR3+,BSTA,*AR2|ADD*AR2+0%,ASTA,*AR3+0%|LD*AR2,As2end:STM#512,BKST#128,sav_sinSTM#128,AR0STM#TWI2,AR4STM #TWI1,AR5STM#-3+LOGN,AR7ST#-1+N/8,sav_grpSTM#3,AR6ST#8,sav_idxst

8、age:STM#DATA,AR2LDsav_idx,AADD*(AR2),ASTLMA,AR3MVDKsav_grp,AR1group: MVMDAR6,BRCRPTBDbend-1LD*AR4,TMPY*AR3+,AMACR*AR5+0%,*AR3-,AADD*AR2,16,A,BSTB,*AR2|SUB*AR2+,BSTB,*AR3|MPY*AR3+,AMASR*AR3,*AR4+0%,AADD*AR2,16,A,BSTB,*AR3+|SUB*AR2,BLD*AR4,TSTB,*AR2+|MPY*AR3+,Abend:PSHMAR0MVDKsav_idx,AR0MAR*AR2+0MAR*A

9、R3+0BANZDgroup,*AR1-POPMAR0MAR*AR3-LDsav_idx,ASUB#1,A,BSTLMB,AR6STLA,1,sav_idxLDsav_grp,ASTLA,ASM,sav_grpLDsav_sin,ASTLA,ASM,sav_sinBANZDstage,*AR7-MVDKsav_sin,AR0STM#DATA+2,AR2STM#DATA+2*N-2,AR3STM#DATA+2*N+3,AR7STM#DATA+4*N-1,AR6STM#-2+N/2,BRCRPTBDp3end-1STM#3,AR0ADD*AR2,*AR3,ASUB *AR2,*AR3,BSTHA,

10、ASM,*AR2+STHA,ASM,*AR3+STHB,ASM,*AR6-NEGBSTHB,ASM,*AR7-ADD*AR2,*AR3,ASUB*AR2,*AR3,BSTHA,ASM,*AR2+STHA,ASM,*AR3-0STHB,ASM,*AR6-NEGBSTHB,ASM,*AR7+0p3end:ST#0,*AR6-ST#0,*AR6p3test:STM#DATA,AR2STM#DATA+1,AR4STM#DATA+2*N+1,AR5ADD*AR2,*AR4,ASUB*AR2,*AR4,BSTHA,ASM,*AR2+ST#0,*AR2MVDD*AR2+,*AR5-STHB,ASM,*AR5

11、STM#DATA+4*N-1,AR3STM#TWI2+512/N,AR4STM#TWI1+512/N,AR5STM#N-2,BRCRPTBDp4end-1STM#512/N,AR0LD*AR2+,16,AMACR*AR4,*AR2,AMASR*AR5,*AR3-,ALD*AR3+,16,BMASR*AR5+0%,*AR2-,BMASR*AR4+0%,*AR3,BSTHA,ASM,*AR2+STHB,ASM,*AR2+NEGBSTHB,ASM,*AR3-STHA,ASM,*AR3-p4end:power:STM #OUTPUT,AR3;AR3指向輸出緩沖地址 STM #255,BRC;塊循環(huán)計(jì)數(shù)

12、器設(shè)置為255 RPTBD power_end-1;帶延遲方式的重復(fù)執(zhí)行指令 STM #DATA,AR2;AR2指向AR0 SQUR*AR2+,A;A := AR2 SQURA *AR2+,A;A := AR2 + AI2 STH A,7,*AR3;將A中的數(shù)據(jù)存入輸出緩沖中, ANDM#7FFFH,*AR3+;避免輸出數(shù)據(jù)過(guò)大在虛擬示波器中顯示錯(cuò)誤power_end: Bpower_end .end命令鏈接文件: /*fft.cmd*/fft.obj-m fft.map-o fft.out MEMORY PAGE 0:ROM(RIX):origin=8000h,length=1000h RO

13、M1 :origin=9000h,length=0200h PAGE 1:B2A(RW):origin=0060h,length=10h B2B(RW):origin=0070h,length=10h INTRAM1(RW) :origin=0400h,length=0200h INTRAM2(RW) :origin=0800h,length=0200h INTRAM3(RW) :origin=1400h,length=0800h OTHER:origin=2000h,length=800hSECTIONS.text:>ROMPAGE 0 INPUT : >ROM1PAGE 0 .

14、data:>INTRAM3PAGE 1twiddle1: >INTRAM1PAGE 1twiddle2: >INTRAM2PAGE 1 tempv:>B2APAGE 1 stack:>B2BPAGE 1 OUTPUT:>OTHERPAGE 1 .stack:>OTHERPAGE 1三角因子:TWI1: .sect "twiddle1" .int 0,201,402,603 .int 804,1005,1206,1407 .int 1607,1808,2009,2210 .int 2410,2611,2811,3011 .int 32

15、11,3411,3611,3811 .int 4011,4210,4409,4609 .int 4808,5006,5205,5403 .int 5602,5800,5997,6195 .int 6392,6589,6786,6983 .int 7179,7375,7571,7766 .int 7961,8156,8351,8545 .int 8739,8933,9126,9319 .int 9512,9704,9896,10087 .int 10278,10469,10659,10849 .int 11039,11228,11416,11605 .int 11793,11980,12167,

16、12353 .int 12539,12725,12910,13094 .int 13278,13462,13645,13828 .int 14010,14191,14372,14552 .int 14732,14912,15090,15269 .int 15446,15623,15800,15976 .int 16151,16325,16499,16673 .int 16846,17018,17189,17360 .int 17530,17700,17869,18037 .int 18204,18371,18537,18703 .int 18868,19032,19195,19358 .int

17、 19519,19681,19841,20001 .int 20159,20318,20475,20631 .int 20787,20942,21097,21250 .int 21403,21555,21706,21856 .int 22005,22154,22301,22448 .int 22594,22740,22884,23027 .int 23170,23312,23453,23593 .int 23732,23870,24007,24144 .int 24279,24414,24547,24680 .int 24812,24943,25073,25201 .int 25330,254

18、57,25583,25708 .int 25832,25955,26077,26199 .int 26319,26438,26557,26674 .int 26790,26905,27020,27133 .int 27245,27356,27466,27576 .int 27684,27791,27897,28002 .int 28106,28208,28310,28411 .int 28511,28609,28707,28803 .int 28898,28993,29086,29178 .int 29269,29359,29447,29535 .int 29621,29707,29791,2

19、9874 .int 29956,30037,30117,30196 .int 30273,30350,30425,30499 .int 30572,30644,30714,30784 .int 30852,30919,30985,31050 .int 31114,31176,31237,31298 .int 31357,31414,31471,31526 .int 31581,31634,31685,31736 .int 31785,31834,31881,31927 .int 31971,32015,32057,32098 .int 32138,32176,32214,32250 .int

20、32285,32319,32351,32383 .int 32413,32442,32469,32496 .int 32521,32545,32568,32589 .int 32610,32629,32647,32663 .int 32679,32693,32706,32718 .int 32728,32737,32745,32752 .int 32758,32762,32765,32767 .int 32767,32767,32765,32762 .int 32758,32752,32745,32737 .int 32728,32718,32706,32693 .int 32679,3266

21、3,32647,32629 .int 32610,32589,32568,32545 .int 32521,32496,32469,32442 .int 32413,32383,32351,32319 .int 32285,32250,32214,32176 .int 32138,32098,32057,32015 .int 31971,31927,31881,31834 .int 31785,31736,31685,31634 .int 31581,31526,31471,31414 .int 31357,31298,31237,31176 .int 31114,31050,30985,30

22、919 .int 30852,30784,30714,30644 .int 30572,30499,30425,30350 .int 30273,30196,30117,30037 .int 29956,29874,29791,29707 .int 29621,29535,29447,29359 .int 29269,29178,29086,28993 .int 28898,28803,28707,28609 .int 28511,28411,28310,28208 .int 28106,28002,27897,27791 .int 27684,27576,27466,27356 .int 2

23、7245,27133,27020,26905 .int 26790,26674,26557,26438 .int 26319,26199,26077,25955 .int 25832,25708,25583,25457 .int 25330,25201,25073,24943 .int 24812,24680,24547,24414 .int 24279,24144,24007,23870 .int 23732,23593,23453,23312 .int 23170,23027,22884,22740 .int 22594,22448,22301,22154 .int 22005,21856

24、,21706,21555 .int 21403,21250,21097,20942 .int 20787,20631,20475,20318 .int 20159,20001,19841,19681 .int 19519,19358,19195,19032 .int 18868,18703,18537,18371 .int 18204,18037,17869,17700 .int 17530,17360,17189,17018 .int 16846,16673,16499,16325 .int 16151,15976,15800,15623 .int 15446,15269,15090,149

25、12 .int 14732,14552,14372,14191 .int 14010,13828,13645,13462 .int 13278,13094,12910,12725 .int 12539,12353,12167,11980 .int 11793,11605,11416,11228 .int 11039,10849,10659,10469 .int 10278,10087,9896,9704 .int 9512,9319,9126,8933 .int 8739,8545,8351,8156 .int 7961,7766,7571,7375 .int 7179,6983,6786,6

26、589 .int 6392,6195,5997,5800 .int 5602,5403,5205,5006 .int 4808,4609,4409,4210 .int 4011,3811,3611,3411 .int 3211,3011,2811,2611 .int 2410,2210,2009,1808 .int 1607,1407,1206,1005 .int 804,603,402,201TWI2: .sect "twiddle2" .int 32767,32767,32765,32762 .int 32758,32752,32745,32737 .int 32728

27、,32718,32706,32693 .int 32679,32663,32647,32629 .int 32610,32589,32568,32545 .int 32521,32496,32469,32442 .int 32413,32383,32351,32319 .int 32285,32250,32214,32176 .int 32138,32098,32057,32015 .int 31971,31927,31881,31834 .int 31785,31736,31685,31634 .int 31581,31526,31471,31414 .int 31357,31298,312

28、37,31176 .int 31114,31050,30985,30919 .int 30852,30784,30714,30644 .int 30572,30499,30425,30350 .int 30273,30196,30117,30037 .int 29956,29874,29791,29707 .int 29621,29535,29447,29359 .int 29269,29178,29086,28993 .int 28898,28803,28707,28609 .int 28511,28411,28310,28208 .int 28106,28002,27897,27791 .

29、int 27684,27576,27466,27356 .int 27245,27133,27020,26905 .int 26790,26674,26557,26438 .int 26319,26199,26077,25955 .int 25832,25708,25583,25457 .int 25330,25201,25073,24943 .int 24812,24680,24547,24414 .int 24279,24144,24007,23870 .int 23732,23593,23453,23312 .int 23170,23027,22884,22740 .int 22594,

30、22448,22301,22154 .int 22005,21856,21706,21555 .int 21403,21250,21097,20942 .int 20787,20631,20475,20318 .int 20159,20001,19841,19681 .int 19519,19358,19195,19032 .int 18868,18703,18537,18371 .int 18204,18037,17869,17700 .int 17530,17360,17189,17018 .int 16846,16673,16499,16325 .int 16151,15976,1580

31、0,15623 .int 15446,15269,15090,14912 .int 14732,14552,14372,14191 .int 14010,13828,13645,13462 .int 13278,13094,12910,12725 .int 12539,12353,12167,11980 .int 11793,11605,11416,11228 .int 11039,10849,10659,10469 .int 10278,10087,9896,9704 .int 9512,9319,9126,8933 .int 8739,8545,8351,8156 .int 7961,77

32、66,7571,7375 .int 7179,6983,6786,6589 .int 6392,6195,5997,5800 .int 5602,5403,5205,5006 .int 4808,4609,4409,4210 .int 4011,3811,3611,3411 .int 3211,3011,2811,2611 .int 2410,2210,2009,1808 .int 1607,1407,1206,1005 .int 804,603,402,201 .int 0,201,-402,-603 .int -804,-1005,-1206,-1407 .int -1607,-1808,

33、-2009,-2210 .int -2410,-2611,-2811,-3011 .int -3211,-3411,-3611,-3811 .int -4011,-4210,-4409,-4609 .int -4808,-5006,-5205,-5403 .int -5602,-5800,-5997,-6195 .int -6392,-6589,-6786,-6983 .int -7179,-7375,-7571,-7766 .int -7961,-8156,-8351,-8545 .int -8739,-8933,-9126,-9319 .int -9512,-9704,-9896,-100

34、87 .int -10278,-10469,-10659,-10849 .int -11039,-11228,-11416,-11605 .int -11793,-11980,-12167,-12353 .int -12539,-12725,-12910,-13094 .int -13278,-13462,-13645,-13828 .int -14010,-14191,-14372,-14552 .int -14732,-14912,-15090,-15269 .int -15446,-15623,-15800,-15976 .int -16151,-16325,-16499,-16673

35、.int -16846,-17018,-17189,-17360 .int -17530,-17700,-17869,-18037 .int -18204,-18371,-18537,-18703 .int -18868,-19032,-19195,-19358 .int -19519,-19681,-19841,-20001 .int -20159,-20318,-20475,-20631 .int -20787,-20942,-21097,-21250 .int -21403,-21555,-21706,-21856 .int -22005,-22154,-22301,-22448 .in

36、t -22594,-22740,-22884,-23027 .int -23170,-23312,-23453,-23593 .int -23732,-23870,-24007,-24144 .int -24279,-24414,-24547,-24680 .int -24812,-24943,-25073,-25201 .int -25330,-25457,-25583,-25708 .int -25832,-25955,-26077,-26199 .int -26319,-26438,-26557,-26674 .int -26790,-26905,-27020,-27133 .int -

37、27245,-27356,-27466,-27576 .int -27684,-27791,-27897,-28002 .int -28106,-28208,-28310,-28411 .int -28511,-28609,-28707,-28803 .int -28898,-28993,-29086,-29178 .int -29269,-29359,-29447,-29535 .int -29621,-29707,-29791,-29874 .int -29956,-30037,-30117,-30196 .int -30273,-30350,-30425,-30499 .int -30572,-30644,-30714,-30784 .int -30852,-30919,-30985,-31050 .int -31114,-31176,-31237,-31298 .int -31357,-31414,-31471,-31526 .int -31581,-31634,-31685,-31736 .int -31785,-31834,-31881,-31927 .int -31971,-32015,-32057,-32098 .int -32138,-32176,-32214,-32250 .int -32

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論