Dear all,

I'm developing a transmitter in python, using USRP1 with LFTX plug-in under GNU 
Radio 3.2.

I'm wondering how to reconfigure some of the parameters of top_block, while the 
flow graph has been running. How can I dynamically alter some of the parameters 
of top_block every 1 second, while it is running. (in my case the parameters 
that I would like to change are amplitude and the frequency). 

I really appreciate any of your help!

Thanks,
Yan

The top_block is built as:

class tx_bpsk_block(gr.top_block):
      def __init__ (self, subdev_spec,freq,verbose,chip_rate,amplitude):
      gr.top_block.__init__(self,"tx_mpsk")
      self._freq = freq
      self._verbose = verbose
      self._amplitude = amplitude
      self._u = usrp_sink_s(0,subdev_spec,chip_rate,self._freq,self._verbose)
      self.in_data = gr.message_source(gr.sizeof_char,14)
      self.msgqq = self.in_data.msgq()
      self._constellation = [-1,1]
      self._mapper = gr.chunks_to_symbols_bf(self._constellation)
      self._gain = gr.multiply_const_ff(self._amplitude)
      self.f2s = gr.float_to_short()
      self.connect(self.in_data,self._mapper,self._gain,self.f2s,self._u)

In main() the parameters set by user promt:
top_block = tx_bpsk_block(options.tx_subdev_spec,options.freq, options.verbose, 
options.chip_rate,options.amplitude)
try:
    top_block.start()
    start_flag = 1
    payload_13barker = '\x01\x01\x01\x01\x01\x00\x00\x01\x01\x00\x01\x00\x01'
    while (start_flag == 1)
         msg_13bit = gr.message_from_string(payload_13barker)
         top_block.msgq.insert_tail(msg_13bit)
         eof_msg = gr.message(1)
         top_block.msgq.insert_tail(eof_msg)
         # Amplitude and frequency suppose to be altered here
         time.sleep(1)
         # amplitude and frequency suppose to be altered again
         top_block.wait()
except KeyboardInterrupt:
       pass


<<attachment: ynie3.vcf>>

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to