discuss-gnuradio
[Top][All Lists]
Advanced

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

Setting Center Frequency


From: Oğuzhan Gedikli
Subject: Setting Center Frequency
Date: Wed, 15 Jun 2022 10:03:09 +0000

Hello, everyone.

I designed both transmiter and receiver in GNU Radio. I am reading data from serial port and according to data I am printing the max value at the receiver. Now, I want to make frequency switch. For frequency switch, I wrote the code below. I have a one problem that is when I run the program, receiver and transmitter turn on and off until it finish. Every frequency switch, they turn on and off. But If I designed range block in GNU Radio and If I change the frequency manually, receiver and transmitter always run. I want to this. But my design in code make blinking in SDR and it makes overflows error.

I will be glad if you help.

    def center_freq_change(self):
        global center_freq
        global stop_freq
        path = "C:\\Users\\my\\Desktop\\ss.txt"
        while center_freq <= stop_freq:
            self.lock()
            self.blocks_file_sink_0.close()
            self.unlock()
            center_freq += diff
            self.lock()
            #self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
            #self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
            tb.set_center_freq(center_freq)
            self.blocks_file_sink_0.open(path)
            self.unlock()
            time.sleep(0.02)
            f = np.fromfile(path, dtype=np.float32)
            f_max = np.max(f)
            print("Max. Value at {} Hz : {}".format(center_freq, f_max))
            if center_freq == stop_freq:
                break
        center_freq = start_freq
        self.lock()
        #self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
        #self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
        tb.set_center_freq(center_freq)
        self.unlock()

reply via email to

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