3 # Copyright 2004 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street,
20 # Boston, MA 02110-1301, USA.
24 Setup USRP for maximum power consumption.
28 from gnuradio import gr
29 from gnuradio import usrp
30 from gnuradio.eng_option import eng_option
31 from optparse import OptionParser
35 src = gr.vector_source_s (range (-period/2, period/2, 1), True)
38 def build_graph (tx_enable, rx_enable):
39 max_usb_rate = 8e6 # 8 MS/sec
45 tx_interp = int (dac_freq / (max_usb_rate/2 * tx_nchan)) # 16
49 rx_decim = int ((adc_freq * rx_nchan) / (max_usb_rate/2)) # 32
54 tx_src0 = gr.sig_source_c (dac_freq/tx_interp, gr.GR_CONST_WAVE, 0, 16e3, 0)
55 usrp_tx = usrp.sink_c (0, tx_interp, tx_nchan, tx_mux)
56 usrp_tx.set_tx_freq (0, 10e6)
57 usrp_tx.set_tx_freq (1, 9e6)
58 fg.connect (tx_src0, usrp_tx)
61 usrp_rx = usrp.source_c (0, rx_decim, rx_nchan, rx_mux)
62 usrp_rx.set_rx_freq (0, 5.5e6)
63 usrp_rx.set_rx_freq (1, 6.5e6)
64 rx_dst0 = gr.null_sink (gr.sizeof_gr_complex)
65 fg.connect (usrp_rx, rx_dst0)
70 parser = OptionParser (option_class=eng_option)
71 parser.add_option ("-t", action="store_true", dest="tx_enable",
72 default=False, help="enable Tx path")
73 parser.add_option ("-r", action="store_true", dest="rx_enable",
74 default=False, help="enable Rx path")
75 (options, args) = parser.parse_args ()
76 fg = build_graph (options.tx_enable, options.rx_enable)
79 raw_input ('Press Enter to quit: ')
82 if __name__ == '__main__':