discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] frequency hopping flow graph problems


From: Hanno Jung
Subject: [Discuss-gnuradio] frequency hopping flow graph problems
Date: Tue, 15 Dec 2009 16:56:28 +0100

Hi,

I'm trying to sent X samples on frequency Y then after that on frequency Z and so on.

But it looks like I have some problems with the flow graph because my second frequency is not beeing transmitted.
It just stops after the first frequency has been transmitted.

I tried different combinations of lock() unlock() and tb.start() but it didn't work.

Here is my simple Code.
Thx in advance

#!/usr/bin/env python

from gnuradio import gr, eng_notation, usrp2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
import math


nsamples=100000000                                   #samples to transmit
interface='eth0'
mac_addr=''

print "nsamples:",  nsamples
print "interface:",  interface

usink=usrp2.sink_32fc(interface, mac_addr)  #usrp2 as sink

dac_rate=usink.dac_rate()                              #dac rate

interp=4
usink.set_interp(interp)
eth_rate=dac_rate/interp                               #eth rate 


g=usink.gain_range()                                     #set auto calculated gain
gain = float(g[0]+g[1])/2
usink.set_gain(gain)

center_freq=24000000000
usink.set_center_freq(center_freq)

amplitude=1                                                   #waveform params
type=gr.GR_SIN_WAVE
waveform_freq=1000000
offset=0

#signal source
source=gr.sig_source_c(eth_rate,      # Sample rate
                                        type,                # Waveform type
                                        waveform_freq, # Waveform frequency
                                        amplitude,     # Waveform amplitude
                                        offset)        # Waveform offset




tb=gr.top_block()

head=gr.head(gr.sizeof_gr_complex, int(nsamples))


tb.connect(source, head)
tb.connect(head, usink)
tb.run()

waveform_freq+=1000000
source.set_frequency(waveform_freq)
tb.run()









reply via email to

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