discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] help with add a new block to GNURadio


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] help with add a new block to GNURadio
Date: Tue, 31 May 2011 13:54:44 -0400

2011/5/31 intermilan <address@hidden>
Hi:
    I recently add a new block to the GNURadio and GRC.The function of the block is to correlate the received spread signal and the local PN code.
I think my block can work well,but there is one thing I do not know how to fix.Sometimes the input of my block is 0 and then it will back to the normal.
But I saw the  output data from the last block ,they are correct.Did anyone have situation  before? and how did it happen? In the accessory are the code
of my block.
   thank you in advance.


I haven't looked over the code too closely, but a few comments. First, because you are consuming and returning the same number of items, you can just make this a gr_sync_block instead of a gr_block, which means you don't have to worry about the forecast function and it simplifies the interface.

On the other hand, since you need at least d_len to make a decision, you'll have to either deal with it by holding state or by forcing the scheduler to give you the correct number of samples, minimum (set_output_multiple can be useful for things like this if d_len is not too large).

Also, you are not initializing sum to anything in the work function, so the initial test in the while loop might trigger incorrectly.

You are also incrementing the in pointer during the for loop, but it looks like you want to remain there until the sum is greater than your threshold. I would think that you would want to test in[0] to in[d_len-1] in one loop, then in[1] to in[d_len], and so on. Here, you are going to skip an entire d_len of inputs.

I'm not sure what you mean by the input of your block is 0. Does this mean the number of input items is 0 or that the inputs themselves are 0?

Hope this helps some.

Tom


reply via email to

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