DSPRelated.com
Forums

QAM Example Programs?

Started by glazarev August 1, 2007
Are there any good/simple QAM example programs online that I can look at
and learn how to use QAM.

Thanks,

DspN00b.


On Aug 1, 6:26 am, "glazarev" <g...@magpieti.com> wrote:
> Are there any good/simple QAM example programs online that I can look at > and learn how to use QAM. > > Thanks, > > DspN00b.
This question is hard to answer without considering a few prerequisite questions: 1. Is this a homework problem? 2. What do you expect the input and output to be? Is it a bunch of symbols and are they in complex baseband? Or do you want the passband version? 3. Do you want a receiver with that? Do you want a large Coke with that?
>1. Is this a homework problem?
No, I've inherited some fax code that I need to maintain.
>2. What do you expect the input and output to be? Is it a bunch of > symbols and are they in complex baseband? Or do you want the > passband version?
I'm a bit confused on the distinction between baseband and passband. It's a telephony appication, so technically, frequencies start at zero, but not all frequencies can be represented. The input would be frames of data representing the wave.
>3. Do you want a receiver with that? Do you want a large Coke with >that?
I think I understand the transmitter, it is the recevier that I don't understand, something simple like a 4-QAM or 8-QAM receiver. Hold the Coke.
glazarev wrote:

(snip)

> I'm a bit confused on the distinction between baseband and passband. It's > a telephony appication, so technically, frequencies start at zero, but not > all frequencies can be represented. The input would be frames of data > representing the wave.
The usual suggestion is that baseband goes to zero frequency, but that is probably too specific. Many times it is necessary to AC couple a system, either through a capacitor or transformer, and allow low but not zero frequency through. I am also not sure about the term passband. The term ethernet uses for the complement to baseband is broadband, but I know the reason for that. In any case, I will arbitrarily say that it is baseband if the lower frequency limit is lower than the bandwidth. That is, that there isn't room for a signal with similar bandwidth below the signal in question. This makes POTS and ordinary ethernet baseband, as expected. -- glen
glazarev wrote:
>> 1. Is this a homework problem? > > No, I've inherited some fax code that I need to maintain.
So you have working code. Why not use it.
>> 2. What do you expect the input and output to be? Is it a bunch of >> symbols and are they in complex baseband? Or do you want the >> passband version? > > I'm a bit confused on the distinction between baseband and passband. It's > a telephony appication, so technically, frequencies start at zero, but not > all frequencies can be represented. The input would be frames of data > representing the wave.
Sounds like you are quite some way from grasping what the receiver is doing if something that elementary is confusing you. Expect some hard going.
>> 3. Do you want a receiver with that? Do you want a large Coke with >> that? > > I think I understand the transmitter, it is the recevier that I don't > understand, something simple like a 4-QAM or 8-QAM receiver.
Start with the V.27ter modem in the code you have. That is 4-PSK and 8-PSK. Then look at the V.29, which is 8-QAM or 16-QAM. The V.17 modem is rather more complex, because of all the trellis stuff. The V.29 modem is about as simple as QAM gets, though. Actually, demodulating the QAM is the easy part of the receiever. Symbol sync, carrier sync, and equalisation is the interesting stuff. The complexity of the modulation only affects that a little bit. Steve
"Steve Underwood" <steveu@dis.org> wrote in message
news:f8r824$4kg$1@nnews.pacific.net.hk...
> > Actually, demodulating the QAM is the easy part of the receiever. Symbol > sync, carrier sync, and equalisation is the interesting stuff. The > complexity of the modulation only affects that a little bit.
Exactly. In the textbooks, they prefer to take that stuff for granted whereas it is the very important and probably the most difficult part to implement. An interaction between symbol sync, carrier sync and equalizer is rather subtle subject. Do you know of any book which has a good treatment on that? Is there an efficient algorithm for the joint estimation of symbol and carrier sync and the adaptation of the equalizer? Vladimir Vassilevsky DSP and Mixed Signal Consultant www.abvolt.com
glen herrmannsfeldt wrote:
> glazarev wrote: > > (snip) > >> I'm a bit confused on the distinction between baseband and passband. >> It's >> a telephony appication, so technically, frequencies start at zero, but >> not >> all frequencies can be represented. The input would be frames of data >> representing the wave. > > The usual suggestion is that baseband goes to zero frequency, but that > is probably too specific. Many times it is necessary to AC couple a > system, either through a capacitor or transformer, and allow low but > not zero frequency through. > > I am also not sure about the term passband. The term ethernet uses > for the complement to baseband is broadband, but I know the reason > for that. > > In any case, I will arbitrarily say that it is baseband if the lower > frequency limit is lower than the bandwidth. That is, that there isn't > room for a signal with similar bandwidth below the signal in question. > This makes POTS and ordinary ethernet baseband, as expected.
The contents of an Ethernet packet typically has large DC, but what it on the wire cannot contain DC. Its a wacky definition of baseband that says what is on the wire in the baseband of the signal. Steve
If it wasn't a challenge, it would be boring.  So, in order to make fixes
and modifications to the code, I'd like to understand a very simple
example.

Please comment on my modulator:

#define RATE 8000.0
#define FREQUENCY 1700.0
#define PI  M_PI
#define AMPLITUDE 8000.0
#define W 2.0*PI*FREQUENCY/RATE
#define MAXDATA 1024

static double I[4] = {1.0, 1.0, -1.0, -1.0};
static double Q[4] = {1.0, -1.0, 1.0, -1.0};

void qam_mod(short *src, int srcsize, short *dest)
{
    int j;
    for(j=0; j<srcsize; j++)
    {
        dest[j] = (short)((AMPLITUDE * I[src[j]] * cos(W*j)) +
                          (AMPLITUDE * Q[src[j]] * sin(W*j)));
    }
}

On Aug 2, 11:24 am, "glazarev" <g...@magpieti.com> wrote:
> If it wasn't a challenge, it would be boring. So, in order to make fixes > and modifications to the code, I'd like to understand a very simple > example. > > Please comment on my modulator: > > #define RATE 8000.0 > #define FREQUENCY 1700.0 > #define PI M_PI > #define AMPLITUDE 8000.0 > #define W 2.0*PI*FREQUENCY/RATE > #define MAXDATA 1024 > > static double I[4] = {1.0, 1.0, -1.0, -1.0}; > static double Q[4] = {1.0, -1.0, 1.0, -1.0}; > > void qam_mod(short *src, int srcsize, short *dest) > { > int j; > for(j=0; j<srcsize; j++) > { > dest[j] = (short)((AMPLITUDE * I[src[j]] * cos(W*j)) + > (AMPLITUDE * Q[src[j]] * sin(W*j))); > } > > }
It may work, but in your code there is exactly one sample per symbol. That means you can't do things like "pulse shaping". You don't say whether you want to or not. Julius
On Aug 2, 11:51 am, julius <juli...@gmail.com> wrote:
> On Aug 2, 11:24 am, "glazarev" <g...@magpieti.com> wrote: > > > > > If it wasn't a challenge, it would be boring. So, in order to make fixes > > and modifications to the code, I'd like to understand a very simple > > example. > > > Please comment on my modulator: > > > #define RATE 8000.0 > > #define FREQUENCY 1700.0 > > #define PI M_PI > > #define AMPLITUDE 8000.0 > > #define W 2.0*PI*FREQUENCY/RATE > > #define MAXDATA 1024 > > > static double I[4] = {1.0, 1.0, -1.0, -1.0}; > > static double Q[4] = {1.0, -1.0, 1.0, -1.0}; > > > void qam_mod(short *src, int srcsize, short *dest) > > { > > int j; > > for(j=0; j<srcsize; j++) > > { > > dest[j] = (short)((AMPLITUDE * I[src[j]] * cos(W*j)) + > > (AMPLITUDE * Q[src[j]] * sin(W*j))); > > } > > > } > > It may work, but in your code there is exactly one sample > per symbol. That means you can't do things like "pulse > shaping". You don't say whether you want to or not. > > Julius
Oh, and it may be that your carrier freq has to be less than your symbol rate (1 in this case). I think. I suck at reading C. Julius