검색어 입력폼

# OFDM QAM 맵퍼, 디맵퍼

등록일 2004.09.17 한컴오피스 (hwp) | 3페이지 | 가격 1,000원

## 소개글

OFDM 통신방식에서 QAM을 구현하는 하나의단계로서 맵퍼와 디맵퍼를 구현. C언어로 작성했습니다.

## 컴파일 실행환경

작업환경
- 데스크탑
- CPU : 1.3GHz
- Memory : 256Mbyte
- Hdd : 60 Gbyte
- 운영체제 : window XP
- 통신속도 : adsl lite (1Mbps)

## 본문내용

/*
This program is 16QAM Mapper and Demapper.
At first, Random function generates random number between 0 and 1 ;
Next, 16QAMMAP function makes MOD[120] array that has Complex numbers.
Last, 16QAMDEMAP funtion generate 4 integers using 1 Complex.
Then, it saves integers in DEMAPDATA[480];
If you execute this program, this program will save DATA[480] , MOD[120],
and DEMAPDATA[480] in output.txt file.
*/

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define LMOD 480
#define quarter 120
struct Complex
{
float real;
float image;
};
int DEMAPDATA[LMOD];
void Random(float *data);
Complex QAM16MAP(int b0, int b1, int b2, int b3 );
//void QAM16DEMAP(Complex &input , int b0, int b1, int b2, int b3 );
void QAM16DEMAP(Complex *input , int *b0, int *b1, int *b2, int *b3 );
main()
{
FILE *output;
output = fopen("output.txt","w");
int i, k, b0, b1, b2, b3, j=0;
Complex MOD[quarter];
float DATA[LMOD];
Random(DATA);
for(i=0 ; i<quarter ; i++) // Maping Sequence
{
b0 = DATA[i*4] = (int)floor( DATA[i*4] + 0.5 );
b1 = DATA[i*4+1] = (int)floor( DATA[i*4+1] + 0.5 );
b2 = DATA[i*4+2] = (int)floor( DATA[i*4+2] + 0.5 );
b3 = DATA[i*4+3] = (int)floor( DATA[i*4+3] + 0.5 );
MOD[i] = QAM16MAP(b0,b1,b2,b3);
}

for(i=0 ; i<24 ; i++)
{
for(k=0 ; k<20 ; k++)
{
fprintf(output," %d ",(int)DATA[j]);
j++;
}
fprintf(output, "\n");
}
j=0;
for(i=0 ; i<40 ; i++)
{
for(k=0 ; k<3 ; k++)
{
fprintf(output,"%f %f ",MOD[j].real,MOD[j].image);
j++;
}
fprintf(output,"\n");
}

// for(i=0 ; i<10 ; i++)printf(" %f %f \n",MOD[i].real,MOD[i].image);

for(i=0 ; i<quarter ; i++) //Demaping Sequence
{
QAM16DEMAP( &MOD[i] , &DEMAPDATA[i*4] , &DEMAPDATA[i*4+1], &DEMAPDATA[i*4+2] , &DEMAPDATA[i*4+3] );
}
j = 0;
for(i=0 ; i<24 ; i++)
{
for(k=0 ; k<20 ; k++)
{
fprintf(output, "%d ",DEMAPDATA[j]);
j++;
}
fprintf(output, "\n");
}
//for(i=0 ; i<10 ; i++)printf(" %d \n",DEMAPDATA[i]);
fclose(output);
return 0;
}

없음