欢迎来到天天文库
浏览记录
ID:27533799
大小:107.00 KB
页数:5页
时间:2018-12-03
《dsp--tms320f2812的快速傅立叶变换fft程序》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、/^*^*^*^*^*^*^*^*^*^^j^P2812fftTI^J^§********************//**//*fft.c*//**//•if•if•if•if•if•if<1^*£>‘1冰<1^<1^<1^^ff/j^T、^T、^T、^T、^T、^T、^T、^T、^T、■/*FastFourierTransform(FFT).Using8points,takesabout1.2mstoexecuteoneFFT.SetsupGeneralPurposeTimer1togenerateev
2、entsat10kHz.Willproduce10kHzoutputonT1PWMandTlPWMpins.*/^includeHsystem.hH#include"eva.h"includeHio2407.hHincludenadc.h”#includeMinterrup.hM#include’’fftcmplx.h”/*Complexstructuredefinition*/externvoidFFT(COMPLEX*Y,intN);/*FFTfunction*//*Thefollowingdefinegivesthenum
3、berofsamples.*//*Itshoulddivideexactlyinto512*//*ShouldNbeincreased,tosayto32,thentheexecution*//*timeoftheFFTwouldincrease*/#defineN8unsignedintperform_fft=0;/*Flagdrivenbyinterrupt*//•if•if•if•if<1^‘1冰<1^<1^<1^<1^/itInitialiseGeneralPurposeTimersGPT1andGPT2*//tlf*1
4、?tlf/>*^Z、^Z、^Z、^T1*f/*InitialiseGeneralPurposeTimer1.*/voidinit_GPTl(void){MCRA
5、=T1PWM;/*TurnonT1PWM*/T1CON=0x8142;/*TurnoffGPTl*/GPTCONA=0x0041;/*Activelow.*/T1PR=1475;/*Sampleat10kHz*/T1CMPR=0;/*Duty=0%*/T1CNT=OxFFFE;/*Setto-2*/T1CON=0x9142;/*Starttimer1*/EVA1FRA=
6、OxFFFF;/*Clearanypendinginterrupts*/EVAIMRA
7、=T1PINT_FLAG;/*EnableTlperiodinterrupt*/}/*InitialiseGeneralPurposeTimer2*/voidinit_GPT2(void)MCRA
8、=T2PWM;/*TurnonT2PWM*/T2CON=0x8142;/*TurnoffGPT2*/GPTCONA
9、=0x0008;/*ControlledfromGPT1*/T2PR=1475;/*Sampleat10kHz*/T2CMPR=0;
10、/*Dutycycle0%decimal*/T2CNT=OxFFFE;/*Setto-2*/T2CON=0x9142;/*Starttimer2*/}/•丄••I*•I**1^•丄••!**1**1^•!>•!>*1*•!>*1^•!*•!>•!>•又扇•又扇•又扇/f*T*/voidinit_ADC()/*NonCascadefor8measurements.*//*WillaffectRESULT0toRESULT7only*/ADCCTRLl=(ADC_SOFT
11、ADC_CPS/*
12、ADC_ACQ_PS3
13、ADC_ACQ_
14、PS2*/);CHSELSEQ1=0x3210;/*8measurements0*/CHSELSEQ2=0x0000;CHSELSEQ3=OxFFFF;CHSELSEQ4=OxFFFF;MAX_CONV=0x0007;/*8measurements,not0*//*Resetsequenceatzeroandsoftwarestartofconversion*/ADCCTRL2=(RST_SEQ1
15、SOC_SEQ1);}/*Nosemicolonhere*/intinput_buffer[N]={8191,8191,8191,8
16、191,0,0,0,0};COMPLEXyfNl;/*variablepassedtoFFTandmodified*/i<1#/7,J,,J,<7*rprp,I*,I**<*,J*<7*,I**>*,J*rj%,J,rj,,J,,J,rj,,J,rj,,J,^J
此文档下载收益归作者所有