Hello.Sorry about that.Here is the generated code with a few of our
modifications at the end.
#!/usr/bin/env python
##################################################
Gnuradio Python Flow Graph
Title: Fm Example
Generated: Tue Jan 6 10:37:52 2015
##################################################
from gnuradio import analog
from gnuradio import audio
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio import uhd
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import time
import wx
class fm_example(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Fm Example")
_icon_path =
“/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png”
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 4e6
#self.freq = freq = 88.1e6
self.freq = freq
##################################################
# Blocks
##################################################
self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
style=wx.NB_LEFT)
self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), “RF
Spectrum”)
self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), “Demod
Spectrum”)
self.Add(self.notebook_0)
self._freq_text_box = forms.text_box(
parent=self.GetWin(),
value=self.freq,
callback=self.set_freq,
label=‘freq’,
converter=forms.float_converter(),
)
self.Add(self._freq_text_box)
self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
self.notebook_0.GetPage(1).GetWin(),
baseband_freq=0,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2.0,
sample_rate=600e3,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title=“FFT Plot”,
peak_hold=False,
win=window.rectangular,
)
self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.notebook_0.GetPage(0).GetWin(),
baseband_freq=freq,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title=“FFT Plot”,
peak_hold=False,
)
self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
self.uhd_usrp_source_0 = uhd.usrp_source(
“,”.join((“serial=2R2CU0U1”, “”)),
uhd.stream_args(
cpu_format=“fc32”,
channels=range(1),
),
)
self.uhd_usrp_source_0.set_subdev_spec(“A:0”, 0)
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_center_freq(freq, 0)
self.uhd_usrp_source_0.set_gain(15, 0)
self.uhd_usrp_source_0.set_antenna(“RX2”, 0)
self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
interpolation=240,
decimation=48,
taps=None,
fractional_bw=None,
)
self.low_pass_filter_0 = filter.fir_filter_ccf(20,
firdes.low_pass(
1, samp_rate, 100e3, 10e3, firdes.WIN_HANN, 6.76))
self.audio_sink_0 = audio.sink(48000, “”, False)
self.analog_wfm_rcv_0 = analog.wfm_rcv(
quad_rate=600e3,
audio_decimation=20,
)
##################################################
# Connections
##################################################
self.connect((self.uhd_usrp_source_0, 0),
(self.wxgui_fftsink2_0,
0))
self.connect((self.uhd_usrp_source_0, 0),
(self.low_pass_filter_0,
0))
self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_1,
0))
self.connect((self.low_pass_filter_0, 0),
(self.analog_wfm_rcv_0,
0))
self.connect((self.rational_resampler_xxx_0, 0),
(self.audio_sink_0, 0))
self.connect((self.analog_wfm_rcv_0, 0),
(self.rational_resampler_xxx_0, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
self.low_pass_filter_0.set_taps(firdes.low_pass(1,
self.samp_rate,
100e3, 10e3, firdes.WIN_HANN, 6.76))
def get_freq(self):
return self.freq
def set_freq(self, freq):
self.freq = freq
self.wxgui_fftsink2_0.set_baseband_freq(self.freq)
self.uhd_usrp_source_0.set_center_freq(self.freq, 0)
self._freq_text_box.set_value(self.freq)
if name == ‘main’:
import ctypes
import sys
if sys.platform.startswith(‘linux’):
try:
x11 = ctypes.cdll.LoadLibrary(‘libX11.so’)
x11.XInitThreads()
except:
print “Warning: failed to XInitThreads()”
parser = OptionParser(option_class=eng_option, usage=“%prog:
[options]”)
(options, args) = parser.parse_args()
freq = 88.1e6
tb1 = fm_example()
tb1.Start(True)
tb1.Wait()
freq = freq+200e3
tb2 = fm_example()
tb2.Start(True)
tb2.Wait()
freq = freq+200e3
tb3 = fm_example()
tb3.Start(True)
tb3.Wait()
freq = freq+200e3
tb4 = fm_example()
tb4.Start(True)
tb4.Wait()
freq = freq+200e3
tb5 = fm_example()
tb5.Start(True)
tb5.Wait()
freq = freq+200e3
Actually,we didn’t type Start and Wait in lowercase letters since when
we
generated the code,
the first letters were already capitalized.
Also, our code was supposed to be up to tb50(I didn’t paste it all since
they were just the same lines of code).
But when tb33 runs, an error occurs (please see attached image )
Is there a limit to the number of "tb"s ?
We would also like to apologize for our mistake.What we meant by
“closing
the scope” was closing the output display, after running our modified
code
so that the next “tb” could run. Do you guys have any suggestions as to
how
to close the display
automatically(for a few seconds,if possible) so that the next “tb” with
an
incremented freq could run?
Thank you very much for your time & help and have a good day.
-SKA15-
On Thu, Feb 5, 2015 at 6:55 PM, Marcus Müller [email protected]