manav
March 9, 2008, 4:20am
1
I am getting segmentation fault with the following…
src_data = (0xff,)
src = gr.vector_source_b(src_data,False)
#expected_results = (1,0,0,0,0,0,0,0)
op = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
op1= gr.head (gr.sizeof_char, 1)
tb.connect(src,op,op1)
dst = gr.vector_sink_b()
tb.connect(op,dst)
tb.connect(op,
gr.file_sink(gr.sizeof_char,
“tx_bytes2chunks.dat”))
tb.connect(op1,
gr.file_sink(gr.sizeof_char, “tx_bytes2bits.dat”))
All that i m trying to do is extract the 1st bit of the vector.
Need help urgently.Am new to GNU radio
manav
March 10, 2008, 2:05pm
2
On Sat, Mar 8, 2008 at 11:20 PM, Manav R. [email protected]
wrote:
tb.connect(op,dst)
Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page
This works for me (note the “del tb” line):
from gnuradio import gr
def print_data(d):
“”“Debugging tool”“”
print ‘Byte\tDec\tHex’
for i in range(len(d)):
b = ord(d[i])
print ‘%4d\t%3d\t %02X’ % (i, b, b)
class MyTopBlock(gr.top_block):
def init (self):
gr.top_block.init (self)
src_data = (0xff,)
src = gr.vector_source_b(src_data,False)
op = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
op1= gr.head (gr.sizeof_char, 1)
self.connect(src,op,op1)
dst = gr.vector_sink_b()
self.connect(op,dst)
self.connect(op,
gr.file_sink(gr.sizeof_char,“tx_bytes2chunks.dat”))
self.connect(op1, gr.file_sink(gr.sizeof_char,
“tx_bytes2bits.dat”))
def main():
tb = MyTopBlock()
tb.run()
del tb #this makes sure files are flushed
f = open(“tx_bytes2chunks.dat”)
print_data(f.read())
f.close()
f = open(“tx_bytes2bits.dat”)
print_data(f.read())
f.close()
if name == ‘main ’:
main()