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.

Pulse position modulation by C6748 LCDK

Other Parts Discussed in Thread: OMAP-L138, STRIKE

Hi,

I would like to generate pulse position modulation signal by C6748 LCDK, i.e, the mapping is '0' -> '10' while '1' -> '01'.

The code is as follows, which is modified from the sine wave generation code in the book 'Digital signal processing and applications with the OMAP-L138 eXperimenter'.

 

*************************************************************

#include "L138_LCDK_aic3106_init.h"

#define LOOPLENGTH 8

#define BUFLENGTH 256

#define DATALENGTH 2

 

int16_t PPM_table_0[LOOPLENGTH] = {10000, 10000, 10000, 10000, 0, 0, 0, 0}; // for mapping '0' -> '10'

int16_t PPM_table_1[LOOPLENGTH] = {0, 0, 0, 0, 10000, 10000, 10000, 10000}; // for mapping '1' -> '01'

int16_t DATA_table[DATALENGTH] = {0, 1}; // data

 

int16_t PPM_ptr_0 = 0; // pointer into lookup PPM table 0

int16_t PPM_ptr_1 = 0; // pointer into lookup PPM table 1

int16_t DATA_ptr = 0; // pointer into lookup Data table

int32_t buffer[BUFLENGTH];

int16_t buf_ptr = 0;

 

interrupt void interrupt4(void) // interrupt service routine

 { 

    if (DATA_table[DATA_ptr] == 0) // mapping of '0'

     {

      int ii; 

      for (ii = 0; ii <= LOOPLENGTH; ii++)  {

         int16_t sample;

         sample = PPM_table_0[PPM_ptr_0];       // read sample from table  

         output_left_sample(sample);          // output sample

         PPM_ptr_0 = (PPM_ptr_0+1)%LOOPLENGTH;  // increment table index  

         buffer[buf_ptr] = (int32_t)(sample); // store sample in buffer

         buf_ptr = (buf_ptr+1)%BUFLENGTH;     // increment buffer index  

       }   

    }

   else  // mapping of '1'

   {

     int ii;

     for (ii = 0; ii <= LOOPLENGTH; ii++)  { 

       int16_t sample;

       sample = PPM_table_1[PPM_ptr_1];       // read sample from table   

       output_left_sample(sample);          // output sample  

       PPM_ptr_1 = (PPM_ptr_1+1)%LOOPLENGTH;  // increment table index

       buffer[buf_ptr] = (int32_t)(sample); // store sample in buffer

       buf_ptr = (buf_ptr+1)%BUFLENGTH;     // increment buffer index

     }  

    }

  DATA_ptr = (DATA_ptr+1)%DATALENGTH;  // increment table index

  return;

}

 

int main(void) {  

   L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);

   while(1);

}

 

*********************************************

 

The expected result should be the loop of '10000, 10000, 10000, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 10000, 10000, 10000'.

However, the result is not correct.

 

Thanks in advance!

 

PP

 

  • Hi,

    Two things about your code strike me immediately.

    1. You shouldn't call output_left_sample() more than once in the interrupt service routine.

    2. output_left_sample() writes to the AIC3106 codec - it strikes me as unusual to try to generate PPM signals through an audio codec. Would you not rather be manipulating a GPIO pin instead - to give a binary output pulse signal?

    Regards,

    Donald

  • Hi, Donald,

     

    Would please provide some basic example of data transmission by GPIO of C6748 LCDK?

    The codes from TI website are for test, not for data transmission.

    I'm a freshman in DSP development.

     

    Thanks.

    PP