discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] simple parallel output shift register


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] simple parallel output shift register
Date: Sat, 1 Sep 2012 11:50:45 -0400

On Wed, Aug 22, 2012 at 7:24 AM, abdullah unutmaz
<address@hidden> wrote:
> Greetings everybody,
>
> I have been trying to design a simple parallel output shift register, use
> gr.buffer & gr.buffer_reader.

Hey Abdullah,

You _really_ don't want to use gr_bufer this way. They aren't meant
for use as blocks but are behind the scenes data structures for
connecting blocks together.

There are some shift register blocks in GNU Radio. It might be that
you can use them as is or adapt one to your purposes.

Tom




> But I am having the error:
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> File "dataST.py", line 61, in <module>
>     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_char*1, samp_rate)
>             self.my_h = gr.head(gr.sizeof_char*1, 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
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>



reply via email to

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