discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Fwd: Question Concerning Custom Modulator Block


From: Jonathan Fox
Subject: [Discuss-gnuradio] Fwd: Question Concerning Custom Modulator Block
Date: Thu, 20 Feb 2014 07:49:05 -0500

Forgot to hit reply all.

On Wed, Feb 19, 2014 at 3:30 AM, Martin Braun <address@hidden> wrote:
On 02/19/2014 12:23 AM, Jonathan Fox wrote:
> Thank you for the response, I apologize, I wasn't very clear at all in
> explaining my problem and I can see that I came across confusing. Let me
> quickly re-explain.
>
> I am creating a QPSK modulator. I have a variable duration/sample rate
> (stretching out the bit sequence, incase my terminology is incorrect).

Is your sampling rate variable, or the symbol rate? Where in the
modulation process should it vary?

> The minimum of it should be about two samples per input bit. I am also
> having a minimum two samples/symbol (just like the stock PSK
> modulator). I am taking the bit sequence of the input char and I am
> using unsigned char datatype like the one block example from the
> tutorial unpack_k_bits_bb. Now I am modulating the bit sequence into a
> waveform that has a set number of samples as a result of the duration
> that is specified. So in the end I have N number of samples generated
> for every byte that is received from the input buffer.

OK, but how is N calculated? At runtime, or at initialization?


> My confusion is the output_buffer. I look at the squarer code from the
> tutorial and see general_work() and think of one input sample comes in,
> one output sample comes out for each execution of the routine. Lets just
> say after processing 1 byte from the input, I have 800 samples of I and
> Q data that make up the modulated waveform. Those 800 samples need get
> out to the flow graph before the next input comes in.

Still don't know how you'd get 800 samples from 1 byte, but let's say
that is correct: In this case, you consume() 1 item (byte) and produce()
800 items (samples).

>> I don't understand what you're writing. In any block, you can output as
>> much items as is space in the output buffer (and should).
>
> So I can write to the output buffer as much as I need to do, does it
> involve set_output_multiple()?

You can write to the output buffer equal to or less than noutput_items
items.

> Do I make sure noutput_items is equal to number of samples I wish to
> output? I always though nouput_items equals 1 for non-vector data, and
> d_vlen for any vectors whose size is d_vlen.

You only read from noutput_items, it's how the scheduler tells you much
space there is in the buffer.

> Would that change the output from a single sample to a vector of samples?

The i/o signature.

> I am going to feed directly to the USRP sink, so a vector output is not
> what I want, just a continuous stream of samples.
>
> Also, where can I see the source code for the PSK modulator block? When
> I type "PSK" in Nautilus' search function, the only C++ code I see the
> receiver, snr estimator. I see python scripts for it qpsk and dpsk, that
> have calls for constellation. If that is it, I apologize for my
> ignorance, I thought it would be a normal C++ block.

We don't need a PSK modulator as such. Open the grc-examples for PSK,
and you will see we connect a "chunks to symbols" block to the pulse
shaping filter.

M


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Both sampling rate and symbol rate is variable, at least I intend it to be. The figurative "N" is calculated at runtime inside general_work() because it is related to the sampling rate. N is representative of the number samples that the modulator produces. Any code I have written takes place inside the general_work() routine.

The 800 samples that make up the waveform is just an arbitrary number I came up with as an example to explain how many samples I have to get out. In my modulator code, my basis functions will generate the same amount of samples as the samples of the bit stream. For prototyping purposes in MATLAB, I had a 100 samples per each bit of the input. So an input of 8 bits after processing was going to give out 800 samples. In my block code this will be controlled by a variable argument.

I know the I/O signature would control that part. So noutput_items is set in the IO signature, the size of it increases when a vector output is set. So if I call set_output_multiple in my constructor and have it set the size of my modulated waveform sample size, will it handle my problem? Is there any block I should look at that has it?




reply via email to

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