hi Tom:

      Thank you for your reply.
      At the beginning, I want to tell you 
about the function of my block.I want to use this block to correlate the
 received signal(spread signal) and local PN code,after I have a the max
 value of the correlate value,I should use the local PN code to despread
 the received demodulated signal and get the original data. So my input 
number and output number may not be strictly 1:1. And the value of d_len
 is the length of PN code,it may be 7,31,etc. So it can be too large.
 And in the block,it firstly test the in[0]...in[d_len-1],then 
in[d_len]...in[2*d_len-1] in while loop,  and after I get the max 
correlate value(which means the value of  sum is lager than the 
threshold), then go to the for loop to despread the spread signal.and in
 that loop,the in pointer should be incremented until the program end.

      The input of the block is 0 means the inputs themselves are 0,and 
after several bytes it will back to the correct value as the output value
 of the last block.And as you suggested,I use gr_sync_block instead of 
the gr_block,but it work worse than before.The input still will become 
to 0 and will never back the correct value. In my opinion,it may be the problem 
of the in pointer,after the block work for a while ,the value in this pointer 
become to 0,and then it back the value of the output of the last block.
      I hope I make myself clearly.So what do you think about this problem and 
how to fix it.
      Thank you again.

Inter

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

2011/5/31 intermilan <[email protected]>







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


_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio                         
                  
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to