/* * fmcw.c * * Created on: 1 December 2017 * by: Daniel Sjoberg * * compile with "gcc ABE_ADCDACPi.c fmcw.c -lm -o fmcw" * run with "./fmcw" */ #include #include #include #include #include #include #include #include "ABE_ADCDACPi.h" // AB Electronics library for AD/DA #define c0 299792458.0 // Speed of light in vacuum #define q 8 // Exponent in number of data bins #define N (1<1) { /* otherwise, do nothing and return */ int k, m; double complex z, w, *vo, *ve; ve = tmp; vo = tmp + n/2; for(k=0; k max_value) { max_value = cabs(a[n]); *max_idx = n; } } *threshold = average*5; return; } int main(int argc, char **argv){ double Isig, Qsig; double complex a1[N*Npad], a2[N*Npad], scratch[N*Npad], ramp[N], testv1[N], testv2[N]; double f1, f2, f0, lambda0, B, V0, Rgate; double R, v, A1, A2; int m, n, p, Npulses; struct timeval t0start, t0stop, tstart, tstop; double T, T0, T1, T2; double fgate, df, delta_f1, delta_f2; int gate_idx, max_idx1, max_idx2; double threshold1, threshold2; char graphstring1[Ngraph+1], graphstring2[Ngraph+1]; /* Set radar parameters */ f1 = 24e9; // Start frequency f2 = 24.45e9; // Stop frequency f0 = (f1 + f2)/2; // Center frequency lambda0 = c0/f0; // Center wavelength B = f2 - f1; // Absolute bandwidth V0 = 2.048; // Maximum output voltage from DAC Rgate = 1.0; // Range gate; blank out values below this Npulses = 100; // Number of pulses used for timing the program /* Initialize data */ for(n=0; n threshold1) { graphstring1[n] = '*'; } else { graphstring1[n] = '.'; } if(cabs(a2[Npad*n+1]) > threshold2) { graphstring2[n] = '*'; } else { graphstring2[n] = '.'; } } // printf("%s\n", graphstring1); // printf("%s\n", graphstring2); } gettimeofday(&t0stop, NULL); // Stop T0 timer T0 = (t0stop.tv_sec - t0start.tv_sec) * 1000.0; // sec to ms T0 += (t0stop.tv_usec - t0start.tv_usec) / 1000.0; // us to ms printf("%d pulses in %f ms, PRR = %f pulses/second\n", Npulses, T0, 100/T0*1000); /* for(n=0; n