CCS/TMS320C5505: Amplitude modulation uisng TMS320C5505

Part Number: TMS320C5505

Tool/software: Code Composer Studio

Dear All,

My objective is to take square root of the input signal and then multiply it with carrier signal to generate the amplitude modulated wave.

The algorithm I am using is:

1) Read the input signal

2) Divide the input by 2 and then add offset to it. This is to ensure that the input is always positive. For example, if input signal swing is -1 V to 1V, I am converting it to 0 to 1V inside DSP.

3) Take square root of input.

4) Multiply it with carrier.

The problem is that, the modulation index of amplitude modulated wave is very low. Does anyone know how to increase the modulation index. Below is the code I am using.

// main.c

#include "stdio.h"
#include "usbstk5505.h"
#include "usbstk5505_led.h"
#include "aic3204.h"
#include "PLL.h"
#include "Dsplib.h"
#include "squareroot.h"
#include "sinewaves.h"
#include "stereo.h"

Int16 left_input;
Int16 right_input;
Int16 left_output;
Int16 right_output;
Int16 mono_input;

#define SAMPLES_PER_SECOND 192000
#define GAIN_IN_dB 30

unsigned long int i = 0;
unsigned int Step = 0;
unsigned int LastStep = 99;
unsigned int key = 0;

void main( void )

     signed short int left_output2 = 0;
    signed short int right_output2 = 0;

    signed short int env = 0;
    signed short carrier =0;

    /* Initialize BSL */
    USBSTK5505_init( );
    /* Initialize PLL */

    /* Initialise hardware interface and I2C for code */
    /* Initialise the AIC3204 codec */

    asm(" bclr XF");

     for ( i = 0  ; i < SAMPLES_PER_SECOND * 6000  ;i++  )
                 aic3204_codec_read(&left_input, &right_input); // Configured for one interrupt per two channels.

                 mono_input = stereo_to_mono(left_input, right_input);
                 carrier= generate_sinewave(40000,31000);

                 left_output2 =  (short) (((long)env * (long)carrier)>>15) ;
                 right_output2 =  (short) (((long)env * (long)carrier)>>15) ;

                        left_output = left_output2;
                 right_output= right_output2;

                 aic3204_codec_write(left_output, right_output);


    /* Disable I2S and put codec into reset */



// squareroot.c

#include "tms320.h"
#include "dsplib.h"  //TI math library
#include "stdio.h"

signed short int generate_squareroot(signed short int input)
   signed short int SquareRoot = 0;
   signed short int SquareRoot2 = 0;

   input = input >> 1;
   input = input + 0x3FFF;

    SquareRoot = input;
    sqrt_16(&SquareRoot, &SquareRoot2, 1); // take square root of sinusoid and store the squared root into SquareRoot
    return SquareRoot2;

  • Hi,

    I've notified the SW team. Their feedback will be posted here.

    Best Regards,


     Please click the Verify Answer button on this post if it answers your question.

       Please make sure you read the forum guidelines first.

  • In reply to Yordan Kovachev:


    I do not understand why you take the square root. I assume that the modulation signal has some Q format (this is fixed point, right) and by shifting (with sign extension I am sure) to the right you can add 1 in the same Q format as the original signal you basically get
    1+m(t) where m(t) is always more than -1 and less than 1, so 1+m(t) is positive.

    Then you multiply 1+m(t) by the modulated signal and the amplitude of m(t) is the modulation index.

    If I have to make a guess I would say that the 1 that you add is not in the right location - that is, it is a different Q format than the m(t)

    So here is what I suggest -
    Plot the m(t) before multiplication by the high frequency signal. See how it behave and you will figure it out