if(start_calc == 1)
{
FFT(log2N, TwiddleCoeff_128, stored_reading);
BitReverseComplex(log2N, stored_reading);
if(i==0)
{
//sum[i] = 0;
i = i+1;
k = k+2;
}
else if(i<=((num_samples/2)-1))
{
test_pin = 1;
re = stored_reading[k++];
im = stored_reading[k++];
rer = Q15_Itof(re);
imr = Q15_Itof(im);
tmpr = rer * rer;
rer = tmpr;
tmpr = imr * imr;
imr = tmpr;
tmpr = sqrt(rer + imr);
//rer = tmpr * 128.;
//sum[i] = rer;
//sum[i] = tmpr;
if(tmpr> maximum)
{
maximum = tmpr;
peak_freq_bin = i;
}
else;
i = i+1;
}
else
{
test_pin = 0;
//Vector_Max(sum,(num_samples/2),&peak_freq_bin);
peak_freq = peak_freq_bin * 8;
WordToStr(peak_freq,txt);
send_string(txt);
start_calc = 0;
//test_pin = 0;
i = 0;
k = 0;
maximum = 0;
peak_freq_bin = 0;
SR = 0x0000; // Set CPU Priority to 0
}
}
else;