Hi,
I have to drew constellation diagram for 16 QAM modulation but I dont know how.
Sampling frequency is 32khz and frequency of a carrier is 8khz. If you need
something more ask me.
Here is my code in CCS if that could help you:
#include "tonecfg.h"
#include "math.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#define pi 3.14159
DSK6713_AIC23_Config config = {
0x0017, // 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume
0x0017, // 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume
0x00d8, // 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume
0x00d8, // 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume
0x0011, // 4 DSK6713_AIC23_ANAPATH Analog audio path control
0x0000, // 5 DSK6713_AIC23_DIGPATH Digital audio path control
0x0000, // 6 DSK6713_AIC23_POWERDOWN Power down control
0x0043, // 7 DSK6713_AIC23_DIGIF Digital audio interface format
0x0019, // 8 DSK6713_AIC23_SAMPLERATE Sample rate control
0x0001 // 9 DSK6713_AIC23_DIGACT Digital interface activation
};
Int16
D[160]={0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,0,0,1,
1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,
0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1
};
Int16
D1[160]={0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,0,1,1,0,1,1,1,1,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1
};
Int16
D2[160]={0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,0,0,1,0,1,1,0,1,1,1,1,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1
};
Int16
D3[160]={0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,1,1,0,1,1,1,1,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,
1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1
};
Int16 A[50000];
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Int16 sample,uzorak1,uzorak3;
float f,fs,F, omega, uzorak,uzorak2;
long br, br2;
f00;
fs2000;
F=f/fs;
omega=2*pi*F;
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config);
br2=0;
for (sample=0; sample<160; sample++)
{
if (D[sample]==0) D[sample]=-1;
if(D1[sample]==0) D1[sample]=3;
if(D2[sample]==0) D2[sample]=-1;
if(D3[sample]==0) D3[sample]=3;
for (br = 0; br <32 ; br++)
{
uzorak = 5000*sin(br2*omega);
uzorak1 = uzorak;
uzorak2=D[sample]*D1[sample]*5000*sin(br2*omega)+D2[sample]*D3[sample]*5000*cos(br2*omega);
uzorak3=uzorak2;
A[br2]=uzorak3;
br2++;
while (!DSK6713_AIC23_write(hCodec, uzorak1));
while (!DSK6713_AIC23_write(hCodec, uzorak3));
}
}
DSK6713_AIC23_closeCodec(hCodec);
}
Any help would be appreciated