/*______________________________________________________________________ TWIDRAD2.C Twiddle Factor Generator for ADSP-21020 Radix-2 FFT Author: 18-FEB-91, Steven Cox, Analog Devices DSP Div. (617) 461-3672 Modified: 25-MAR-91, Steven Cox, Analog Devices DSP Div. (617) 461-3672 12-JUN-91, Ronnin Yee, Analog Devices DSP Div. (617) 461-3672 ______________________________________________________________________*/ #include #include main() { int i, n; double freq, c, s; double pi; FILE *s_file; FILE *c_file; char filename1[25]; char filename2[25]; /* initialize pi */ pi = 4.0*atan(1.0); printf("%c%c%c%c",27,91,50,74); /*clear screen*/ printf("%c%c%c",27,91,72); /*curser home*/ printf("_____________Radix-2 FFT Twiddle Factor Generator____________\n"); printf("Generates a 1/2 a sine and cosine for use with the ADSP-21020\n"); printf("radix-2 FFT code. Use with the radix-2 FFT - FFTRAD2.ASM only.\n"); printf("12-JUN-91, Ronnin Yee, Analog Devices\n"); printf("_____________________________________________________________\n"); printf("Enter the number of points -> "); scanf(" %d",&n); n=n/2; printf("\nEnter the real twiddles filename -------> "); scanf(" %s",filename1); c_file=fopen(filename1,"w"); printf("\nEnter the imaginary twiddles filename --> "); scanf(" %s",filename2); s_file=fopen(filename2,"w"); freq=2.0*pi*0.5/(double)n; for (i=0; i <= n-1; i++) { s=sin((double)i * freq); c=cos((double)i * freq); fprintf(s_file,"%22.14e\n",s); fprintf(c_file,"%22.14e\n",c); printf("%d : %22.14e : %22.14e\r",i,s,c); } fclose(s_file); fclose(c_file); printf("\nFinished\n"); }