discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Using the dqpsk modulator


From: karim
Subject: Re: [Discuss-gnuradio] Using the dqpsk modulator
Date: Tue, 14 Apr 2009 04:03:13 -0700
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Eric Blossom wrote:
On Thu, Apr 09, 2009 at 09:46:43AM -0700, karim wrote:
Hi,
I am trying to use the dqpsk modulator block to modulate some data and then take the output and separate it to real and imag. This is the code, it runs but the sinks are empty and have no data. What am I doing wrong?

You're printing the contents of the vector sinks in your
initialization code, before the graph has started running.

Try printing their contents after my_top_block().run() returns.

Eric


I added a function to print the sinks after I call my_top_block().run()

But the sinks are still empty. I also tried directing the output of the qpsk modulator to a file and it's also empty (the code below).



from gnuradio import gr, gru, modulation_utils, blks2
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser

import random, time, struct, sys, math


#no GUI
#source: stream from file_source
#connect with DQPSK: input: byte stream, output:complex
#change it to 2 parts:imagine and Real
#connect with gr.complex_to_real or gr.complex_to_imag
#display data in sink1 (real) and sink2 (imag)

class my_top_block(gr.top_block):

  def __init__(self):
    gr.top_block.__init__(self)

    src_data = (1,0,1,0,1,0,1,0)
    src = gr.vector_source_b (src_data)

    #input: unsigned char, output: complex
    qpsk = blks2.dqpsk_mod(2,.35,True, False, False)
    self.connect (src,qpsk)

    real = gr.complex_to_real()
    imag = gr.complex_to_imag()
    self.connect(qpsk,real)
    self.connect(qpsk,imag)

    self.sink1 = gr.vector_sink_f()
    self.sink2 = gr.vector_sink_f()

    self.connect(real,self.sink1)
    self.connect(imag,self.sink2)

    qpsk_file_op=gr.file_sink(gr.sizeof_gr_complex, "qpsk_op.dat")

    self.connect(qpsk,qpsk_file_op)


  def print_data(self):
    print "Data in sink1 is: ",self.sink1.data()
    print "Data in sink2 is: ",self.sink2.data()


if __name__ == '__main__':
    try:
        my_top_block().run()
        my_top_block().print_data()
    except KeyboardInterrupt:
        pass




reply via email to

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