This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM modulator using TMS320C6713

Hello, I've been trying to implement an AM modulator using C6713, according to instructions found on the book Communication System Design  Using DSP Algorithms with Laboratory  Experiments for the TMS320C6713 DSK by Steven A. Tretter. The author suggests to use  floating point arithmetic, so I wrote the code shown below. The problem is that after multiplying I observe in the oscilloscope a waveform which seems to be periodic but doesn't look like a typical AM waveform (which is what I want to get). I've been trying to change some parameters, like amplitude of the two sine waves which are supposed to be multiplied but to no avail. Any help will be much appreciated.

#include <math.h>
#include "DSK6713_AIC23.h"                    // codec support
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;            //set sampling rate
#define DSK6713_AIC23_INPUT_MIC 0x0015
#define DSK6713_AIC23_INPUT_LINE 0x0011
Uint16 inputsource=DSK6713_AIC23_INPUT_MIC; // select input

#define SAMPLING_FREQ 8000
#define PI 3.14159265358979

float frequency = 2000.0;
float amplitude = 30000.0;
float frecuencia =400.0;
float amplitud= 15000.0;
float incremento;
float angulo=0.0;
float theta_increment;
float theta = 0.0;
float vector[100];
float salida;
short index=0;
float signal1;
float signal2;

interrupt void c_int11()
{
  theta_increment = 2*PI*frequency/SAMPLING_FREQ;
  theta += theta_increment;
  if (theta > 2*PI) theta -= 2*PI;
  incremento=2*PI*frecuencia/SAMPLING_FREQ;
  angulo +=incremento;
  if (angulo > 2*PI) angulo -= 2*PI;
 
  signal1=amplitude*sin(theta);
  signal2=amplitud*sin(angulo);

signal2=signal2/amplitude;
signal2 = 1+signal2;

  vector[index++]=(short)(signal1*signal2);
  if(index>=100) index=0;
  output_left_sample((short)(signal1*signal2));
  return;
}

void main()
{
  comm_intr();
  while(1);
}

  • Carlos,

    There have been a couple of recent threads about AM coding. Please search the C6000 Single Core DSP Forums for those to find some of the discussions. I recall one of the Community Member discussions had some good theory on AM methods and mathematics.

    Do you get the same waveform if you run it in MatLab?

    If you graph the vector array, does it look like what you expect it to look like?

    I suspect you are getting the waveform you are generating, which means that your code is doing what it says it is doing. But you need to study the math that you are implementing to figure out what you really want it to do. Sorry this is so vague, but I am not a DSP algorithm/math expert, but you need to be in order to get a program to do what you want it to do.

    Regards,
    RandyP

  • The value of signal1 times the value of signal2 mathematically can range up to 30000 * (1 + 15000/30000) = 45000, but type short can represent only up to 32767.  You need to reduce the signal and carrier amplitudes.