discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] No simple_correlator output


From: irene159
Subject: Re: [Discuss-gnuradio] No simple_correlator output
Date: Tue, 27 May 2008 06:09:05 -0700 (PDT)

I tried simplifying the problem, I have deleted all the DQPSK modulation
part. I just kept the simple_framer, uchar_to_float converter and the
simple_correlator connected as follows:

#!/usr/bin/env python

from gnuradio import gr,audio
from array    import array     # Array
import wx,os,sys

import dqpsk            # QPSK Modulation

# Define dialog component
ID_START = 101
ID_EXIT  = 103

# Packet size
p_size = 1024


# -----------------------------------------
# Function: Read file and return data array
# -----------------------------------------
def ReadFile (arrTxt):
    file = open('./Test/Test.txt','r')
    while True:
        data = file.read(1)  # Read data, 1 byte each time
        if len(data) == 0:  # If reach EOF, finish the loop
            break
        arrTxt.append(ord(data)) # Store data(int) into array    
    return arrTxt
    

# ---------------------------------------
# Class: Main window
# ---------------------------------------
class MainWindow(wx.Frame):
    """ We simply derive a new class of Frame. """
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size = (320, 240))
        self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
        self.CreateStatusBar() # A statusbar in the bottom of the window
        #Setting up the menu
        filemenu=wx.Menu()
        filemenu.Append(ID_START, "&Start", "Start test")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT, "&Exit", "Terminate the program")
        # Creating the menubar
        menuBar=wx.MenuBar()
        menuBar.Append(filemenu, "&File",) #Adding the filemenu to the
MenuBar
        self.SetMenuBar(menuBar) #Adding the MenuBar to the Frame content
        wx.EVT_MENU(self, ID_START, self.OnStartTest)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)   #attach the menu-event
ID_EXIT to method self.OnExit
        self.Show(True) # Note the capital on 'True'
        
    def OnStartTest(self, e):
        arrTxt = array('B')
        arrTxt.append(0)
        arrTxt = ReadFile(arrTxt)        
        # print 'Total = ', len(arrTxt), 'bytes'
        self.control.SetValue('[Read File] - Finish!')
        # Construct graph
        fg = gr.top_block()  
        arrTxt[0] = 0  # you know, for the diff encoding stuff
        bytes_src = gr.vector_source_b(arrTxt, False)
        framer = gr.simple_framer(p_size)
        conversion = gr.uchar_to_float()
        correlator = gr.simple_correlator(p_size)       
        dst = gr.file_sink(gr.sizeof_char,"Frame_test.txt")
        fg.connect(bytes_src, framer, conversion, correlator, dst)
        fg.start()
        raw_input('Test running...')
        fg.stop()
    
    def OnExit(self, e):
        self.Close(True) #Close the frame, note capitalization of 'T' in
'True'

# ---------------------------------------
# Main
# ---------------------------------------
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "QPSK_Test")
app.MainLoop()



Still nothing coming out of the simple_correlator... 

-- 
View this message in context: 
http://www.nabble.com/No-simple_correlator-output-tp17471158p17490080.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

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