# Simple parallel output shift register

**URL:** <https://www.ruby-forum.com/t/simple-parallel-output-shift-register/222363>\
**Category:** GNU Radio\
**Created:** [August 27, 2012, 2:00pm UTC](https://www.ruby-forum.com/t/simple-parallel-output-shift-register/222363 "2012-08-27T14:00:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 27, 2012, 2:00pm UTC](https://www.ruby-forum.com/t/simple-parallel-output-shift-register/222363/1 "2012-08-27T14:00:57Z")

</div>

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\_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

---

<div class="post-metadata">

**Author:** ![abdullah\_unutmaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/65b543/32.png) [@abdullah\_unutmaz](https://www.ruby-forum.com/u/abdullah_unutmaz)\
**Post date:** [September 1, 2012, 5:52pm UTC](https://www.ruby-forum.com/t/simple-parallel-output-shift-register/222363/2 "2012-09-01T17:52:02Z")

</div>

On Wed, Aug 22, 2012 at 7:24 AM, abdullah unutmaz  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
