Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 134 lines (121 sloc) 4.412 kB
371bdb3 @riveridea June 4 2012 by Alex
authored
1 #!/usr/bin/env python
2 ##################################################
3 # Gnuradio Python Flow Graph
4 # Title: Top Block
5 # Generated: Mon May 21 21:21:36 2012
6 ##################################################
7
8 from gnuradio import blks2
9 from gnuradio import eng_notation
10 from gnuradio import gr
11 from gnuradio import uhd
12 from gnuradio import window
13 from gnuradio.eng_option import eng_option
14 from gnuradio.gr import firdes
15 from gnuradio.wxgui import fftsink2
16 from grc_gnuradio import wxgui as grc_wxgui
17 from optparse import OptionParser
18 import wx
19
20 class top_block(grc_wxgui.top_block_gui):
21
22 def __init__(self):
23 grc_wxgui.top_block_gui.__init__(self, title="Top Block")
24 _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
25 self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
26
27 ##################################################
28 # Variables
29 ##################################################
30 self.samp_rate_1 = samp_rate_1 = 1024000
31 self.samp_rate_2 = samp_rate_2 = samp_rate_1/10
32
33 ##################################################
34 # Blocks
35 ##################################################
36 self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
37 self.GetWin(),
38 baseband_freq=928000000,
39 y_per_div=20,
40 y_divs=10,
41 ref_level=0,
42 ref_scale=2.0,
43 sample_rate=samp_rate_1,
44 fft_size=1024,
45 fft_rate=15,
46 average=False,
47 avg_alpha=None,
48 title="FFT Plot",
49 peak_hold=False,
50 )
51 self.Add(self.wxgui_fftsink2_1.win)
52 self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
53 self.GetWin(),
54 baseband_freq=908000000,
55 y_per_div=20,
56 y_divs=10,
57 ref_level=0,
58 ref_scale=2.0,
59 sample_rate=samp_rate_1,
60 fft_size=1024,
61 fft_rate=15,
62 average=False,
63 avg_alpha=None,
64 title="FFT Plot",
65 peak_hold=False,
66 )
67 self.Add(self.wxgui_fftsink2_0.win)
68 self.uhd_usrp_source_0 = uhd.usrp_source(
69 device_addr="",
70 stream_args=uhd.stream_args(
71 cpu_format="fc32",
72 channels=range(2),
73 ),
74 )
75 #self.uhd_usrp_source_0.set_clock_rate(918000000, uhd.ALL_MBOARDS)
76 tr1 = uhd.tune_request(908e6, rf_freq=918e6, rf_freq_policy=uhd.tune_request.POLICY_MANUAL);
77 tr2 = uhd.tune_request(928e6, rf_freq=918e6, rf_freq_policy=uhd.tune_request.POLICY_MANUAL);
78 self.uhd_usrp_source_0.set_subdev_spec("A:0 A:0", 0)
79 self.uhd_usrp_source_0.set_samp_rate(1024000)
80 #self.uhd_usrp_source_0.set_center_freq(908000000, 0)
81 self.uhd_usrp_source_0.set_center_freq(tr1, 0)
82 self.uhd_usrp_source_0.set_gain(0, 0)
83 self.uhd_usrp_source_0.set_antenna("RX2", 0)
84 #self.uhd_usrp_source_0.set_center_freq(928000000, 1)
85 self.uhd_usrp_source_0.set_center_freq(tr2, 1)
86 self.uhd_usrp_source_0.set_gain(0, 1)
87 self.uhd_usrp_source_0.set_antenna("RX2", 1)
88 self.gr_throttle_0_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate_1)
89 self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate_1)
90 self.blks2_rational_resampler_xxx_0_0 = blks2.rational_resampler_ccc(
91 interpolation=1,
92 decimation=samp_rate_1/samp_rate_2/10,
93 taps=None,
94 fractional_bw=None,
95 )
96 self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_ccc(
97 interpolation=1,
98 decimation=samp_rate_1/samp_rate_2/10,
99 taps=None,
100 fractional_bw=None,
101 )
102
103 ##################################################
104 # Connections
105 ##################################################
106 self.connect((self.uhd_usrp_source_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
107 self.connect((self.gr_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
108 self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_throttle_0, 0))
109 self.connect((self.uhd_usrp_source_0, 1), (self.blks2_rational_resampler_xxx_0_0, 0))
110 self.connect((self.blks2_rational_resampler_xxx_0_0, 0), (self.gr_throttle_0_0, 0))
111 self.connect((self.gr_throttle_0_0, 0), (self.wxgui_fftsink2_1, 0))
112
113 def get_samp_rate_1(self):
114 return self.samp_rate_1
115
116 def set_samp_rate_1(self, samp_rate_1):
117 self.samp_rate_1 = samp_rate_1
118 self.set_samp_rate_2(self.samp_rate_1/10)
119 self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate_1)
120 self.wxgui_fftsink2_1.set_sample_rate(self.samp_rate_1)
121
122 def get_samp_rate_2(self):
123 return self.samp_rate_2
124
125 def set_samp_rate_2(self, samp_rate_2):
126 self.samp_rate_2 = samp_rate_2
127
128 if __name__ == '__main__':
129 parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
130 (options, args) = parser.parse_args()
131 tb = top_block()
132 tb.Run(True)
133
Something went wrong with that request. Please try again.