discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] USRP Sampling


From: mgray
Subject: [Discuss-gnuradio] USRP Sampling
Date: Wed, 30 Mar 2005 15:15:38 -0700 (MST)

I have the following program to capture USRP samples and write them to a 
file.  What is a simple way to have the program capture for X number of 
samples and then stop?

Thanks



from gnuradio import gr
from gnuradio import audio
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser

def build_graph (IF_freq, filename):

    fg = gr.flow_graph ()

    # 256K sample rate
    adc_rate = 64e6
    decim = 16
    mux = 0xf0f0f0f0

    src = usrp.source_c (0, decim, 1, mux)
    src.set_rx_freq (0, -IF_freq)

    src.set_pga (0, 20)

    dst1 = gr.file_sink (gr.sizeof_gr_complex, filename)
    fg.connect ((src, 0), dst1)
    return fg

def main ():

    fg = build_graph (10.7e6, "if_sample_4m_complex.dat")

    fg.start ()
    raw_input ('Press Enter to quit: ')
    fg.stop ()

if __name__ == '__main__':
    main ()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]