![]() |
|
||||||||||||||
| . 网站首页 . 新闻 . 新品 . 方案 . 专访 . 活动 . DSP . EDA . 评测室 . 技术文库 . 会员区 . 商城 . 服务导航 . 邮购 . 资源 . | ||
|
||
|
|||||
| TMS320F2812 FFT源码(包括详细的应用文档) | |||||
作者:61IC 文章来源:本站原创 点击数: 更新时间:2007-1-16 ![]() |
|||||
|
/* #include "system.h" #include "fftcmplx.h" /* Complex structure definition*/ extern void FFT(COMPLEX *Y, int N); /* FFT Function */ /* The following define gives the number of samples. */ #define N 8 unsigned int perform_fft = 0; /* Flag driven by interrupt */ /*************************************************************/ /* Initialise General Purpose Timer 1. */ void init_GPT1(void) EVAIFRA = 0xFFFF; /* Clear any pending interrupts */ /* Initialise General Purpose Timer 2 */ void init_GPT2(void) /**************************************************************/ void init_ADC() ADCCTRL1 = (ADC_SOFT | ADC_CPS /*| ADC_ACQ_PS3 | ADC_ACQ_PS2*/ ); CHSELSEQ1 = 0x3210; /* 8 measurements 0 */ /* Reset sequence at zero and software start of conversion */ ADCCTRL2 = ( RST_SEQ1 | SOC_SEQ1); } /* No semicolon here */ /***********************************************************/ int input_buffer[N] = {8191, 8191, 8191, 8191, 0, 0, 0, 0}; COMPLEX y[N]; /* Variable passed to FFT and modified */ /***********************************************************/ void shuffle_and_read(void) for ( i = N-1 ; i > 0 ; i--) input_buffer[0] = (RESULT2 >> 3); /***********************************************************/ void copy_input_to_complex(void) for ( i = 0 ; i < N; i++) /***********************************************************/ void main(void) init_system(); /* Initialize variables and hardware */ init_ADC(); /* Initialise ADC */ MCRB &= 0xFFFE; /* I/O on IOPC0 for monitoring purposes */ IMR |= INT2; /* Turn on INT 2 */ asm(" CLRC INTM"); /* Turn on maskable interrupts */ for ( ;; ) PCDATDIR = 0x0101; /* IOPC0 high */ ADCCTRL2 |= SOC_SEQ1; /* Start next conversion*/ copy_input_to_complex(); /* Copy inputs from receive buffer */
/* Determine magnitude of (y[0]).real */ if ( (y[0]).real > 0) /* Determine magnitude of (y[0]).real */ if ( (y[2]).real > 0) /* Scale output in range 0 to 1475 */ temp = (signed long)(output1 * 2952); T1CMPR = output1; temp = (signed long)( output2 * 2952); T2CMPR = output1; shuffle_and_read(); /* Read in latest value from ADC */ PCDATDIR = 0x0100; /* IOPC0 low */ } /* End if */ } /* End for */ } /* End main() */ /************************************************************/ /* Interrupt routine */ void c_int2(void) if ( 0x0027 == PIVR) if ( x < 19 ) /* Increase if FFT with more points */ } /* End of fft.c */ |
|||||
| 欢迎点击进入:TI德州中文网 (国内唯一针对TI应用的中文技术网站) 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 没有相关文章 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 | | |||
|
|