FIFO question



Can anyone please help me? I have the following Gnuradio code to test
a C++ application:

self.src = gr.sig_source_f(500e3,gr.GR_SIN_WAVE,100e3,0.1)
self.dst0 = gr.file_sink(gr.sizeof_float,“myfifo”)

I’m trying to capture 1000 samples every ten seconds with the
following bit of C++ code:

while (j < chunks)
result = fread(buffer1,sizeof(float),1000,fifo1);
k = k + 1;
if (k == skip)
for (l = 0;l < 1000;l++)
big_buff[l+count] = buffer1[l];
k = 0;
j = j + 1;
count = count + 1000;

where chunks is equal to the amount of 1000 sample reads that I want
and skip is equal to 5000 to read 1000 samples out of every 5 000 000.
So for instance if chunks is 4, this app should run for 40 seconds
since 500 000 samples should get written to the FIFO every second.
The app terminates after about 2 seconds. I write big_buff to a text
file and it does indeed contain 4000 samples. The FFT also shows that
it is a 100kHz sine wave.

What I intend to do is use 2 FIFOs to capture data from two TVrx
daughtercards. I then want to see what the frequency drift between
the two oscillators after a certain amount of time is so obviously I
want to capture a certain amount of samples every now and then and
compare the FFTs from the two channels.

Does anyone know what I am doing wrong?

Thank you very much.


Sebastiaan H.
Radar and Remote Sensing Group, University of Cape Town
Tel: +27 83 305 5667