Greetings everybody,
I have been trying to design a simple parallel output shift register,
use gr.buffer & gr.buffer_reader.
But I am having the error:
File “dataST.py”, line 61, in
tb = top_block()
File “dataST.py”, line 40, in init
self.my_buffer=gr.buffer(11,gr.sizeof_char*1,self.my_h)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py”,
line 312, in buffer
return _gnuradio_core_runtime.buffer(*args, **kwargs)
TypeError: in method ‘buffer’, argument 3 of type ‘gr_block_sptr’
You can see all of my program below:
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx
import time
class top_block(grc_wxgui.top_block_gui):
def init(self):
grc_wxgui.top_block_gui.init(self, title=“Top Block”)
_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 = 1000000
##a################################################
Blocks
##################################################
self.my_vec_src = gr.vector_source_b((1, 1, 1, 1,1, 1, 1, 1,1, 1, 1),
True, 1)
#self.my_vec_snk = gr.vector_sink_b(1)
self.my_thro = gr.throttle(gr.sizeof_char1, samp_rate)
self.my_h = gr.head(gr.sizeof_char1, 11)
buffer
self.my_buffer=gr.buffer(11,gr.sizeof_char*1,self.my_h)
self.my_buffer_reader=gr.buffer_reader(self.my_buffer,11)
##################################################
Connections
##################################################
self.connect((self.my_vec_src, 0), (self.my_thro, 0))
self.connect((self.my_thro, 0), (self.my_h, 0))
self.connect((self.my_h, 0), (self.my_buffer, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
if name == ‘main’:
parser = OptionParser(option_class=eng_option, usage="%prog:
[options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.Run(True)
while(True):
#time.sleep(10)
if(tb.my_buffer.done()):
my_data=tb.my_buffer_reader.read_pointer()
print "data: ",my_data
Is there anyway to use gr_buffer & gr_buffer_reader properly to design a
simple parallel output shift register?
I searched not only the other discussions in the forum, but also
examples I can find. I also tried to find a
use of gr_buffer in python files, also in doxygen, nothing… Third
argument , “link” , is confusing, I tried to make a connection
between gr_buffer and gr_throttle instead of gr_head, unfortunately it
does not work, too.
What should I do?
Thanks in advance,
Abdullah