In your other thread:

http://arduino.cc/forum/index.php/topic,82543.0.htmlthere is a link:

http://101science.com/dsp.htm , my advise: take a course.

If you don't know how to set Timer, and don't want to use MsTimer2 library, there is other way around: take a several analog readings, than calculate average value and store it into array.

Sampling rate would decrease by averaging N, and you don't have to worry about aliasing much.

for(i=0; i<N; i++ ) { // <---external cycle - "main"

long temp = 0;

for ( int8_t iner = 0; iner < AVRG; iner++) { // <--- internal cycle

ADCSRA |= (1<<ADSC);

while(!(ADCSRA & 0x10));

temp = temp + ADC;

}

x[i] = temp / AVRG; // <--- store 1 value from 10 or so

}

Making AVRG = 10, sampling rate : 9 kHz / 10 ~= 900 Hz, which is good up F/2 = 450 Hz signal input.

#define N_WAVE 1024 //could be any size >= than FFT_SIZE below

#define LOG2_N_WAVE 10 /* log2(N_WAVE) */

#define FFT_SIZE 256 // <<<-- for 128 bins

#define log2FFT 8 // <<<--- Log2 (256)

Sinewave size should be no less than your FFT_size: 256. You can create smaller sinewave table with help of Excell, LibreOffice, or Arduino, loading a scketch to print out values as a table.