DSP

DSP TMS320C5509A 控制DDS AD9854芯片进行AM-MSK调制

2019-07-13 17:44发布

https://blog.csdn.net/pxy198831/article/details/87017571DSP TMS320C5509A 控制DDS AD9854芯片进行AM幅度调制 AM-MSK调制是MSK的变种,用于航空ACARS通信。 以1200Hz表示数据位和前一位不同,2400Hz表示数据位和前一位相同。两种高低频率的相位连续。 由于传送速率为2400Hz,传输一位数据2400Hz的调制信号是一个周期的波形,而1200Hz则是半个周期的波形。 由于起始相位不同,0,1分别对应4种不同的情况,这样做的好处是能够保证相位连续。 2400Hz和1200Hz的ROM表可以用MATLAB生成,可以生成通用的也可以根据采用频率生成 专用的ROM表,具体看代码。 interrupt void dmaCh0Isr(void) { int I_Q_result; static int AM_MSK24[18]={0,12062,22430,29648,32702,31166,25248,15788,4106,-8149,-19261,-27666, -32188,-32188,-27666,-19261,-8149,4106}; static int AM_MSK12[34]={0,6141,12062,17557,22430,26509,29648,31739,32702,32509,31166, 28715,25248,20886,15788,10125, 4106,-2058,-8149,-13953,-19261,-23888,-27666,-30468,-32188,-32678,-32188,-30468,-27666,-23888,-19261,-13953, -8149,-2058}; static int AM_MSK_DATA[10]={0,1,0,0,1,1,1,0,0,1}; int ATW; static int noise_flag = 0,i_18=0,j_34=0,k_10=0; unsigned char AM_H,AM_L; static int fase=0; //unsigned int AM_register = 0; //float ac,dc; //float temp; //static int i; //long int tmp; //处理接收到的事情 // dmaCh0Process(); //Read the DMA status register to clear it so new interrupts will be seen DMA_RGETH(hDMACH0,DMACSR); DMA_start(hDMACH0); /* Begin Transfer */ // head++; */ if (dds_flag == 1) { if(k_10==10) { k_10=0; } if ((j_34==17)||(j_34==34)) { j_34=0; k_10++; } if (i_18==18) { i_18=0; k_10++; } if (k_10 == 0) { if(AM_MSK_DATA[k_10]==0) { I_Q_result = AGC_audio(AM_MSK12[j_34]); } else { I_Q_result = AGC_audio(AM_MSK12[j_34+17]); } j_34++; } else { if(AM_MSK_DATA[k_10]==AM_MSK_DATA[k_10-1]) { if(AM_MSK_DATA[k_10]==0) { I_Q_result = 0-AGC_audio(AM_MSK24[i_18++]); } else { I_Q_result = AGC_audio(AM_MSK24[i_18++]); } } else { if(AM_MSK_DATA[k_10]==0) { I_Q_result = AGC_audio(AM_MSK12[j_34]); } else { I_Q_result = AGC_audio(AM_MSK12[j_34+17]); } j_34++; } } fir((DATA *)&I_Q_result, (DATA *)B_BS,(DATA *)&I_Q_result, BS_dbuf,1,BL_BS); // audio_DDS[Index] += 32768; // I_Q_result = 2*A*((float)I_Q_result)/(1+A); if (I_Q_result > 0) { I_Q_result = ((float)I_Q_result)/8192*2048; } if (I_Q_result < 0) { I_Q_result = ((float)I_Q_result)/8192*2048; } // dc = 2048; // dc = ((1-A)*0x3fff)/(1+A); // ac = (2*A*I_Q_result)/(1+A); ATW = (2*A*I_Q_result)/(1+A) + 2048; // temp = ATW; // ATW = (temp/65536)*4096; AM_H = (ATW&0x0f00)>>8; AM_L = ATW&0xff; audio_DDS[Index] = (AM_H<<8)|AM_L; if(Index>=200) { Index = 0; } if (audio_DDS[Index++] > 1000) { if (noise_flag<200) { noise_flag++; } } else { noise_flag = 0; } if (noise_flag != 200) { AD9854_WR_Byte(OSK_I1_ADDRESS,AM_H); //设置I通道幅度 AD9854_WR_Byte(OSK_I2_ADDRESS,AM_L); } else { AD9854_WR_Byte(OSK_I1_ADDRESS,0xff); //设置I通道幅度 AD9854_WR_Byte(OSK_I2_ADDRESS,0xff); } ad9854_update(); rear++; } }