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);
}