DSPRelated.com
Forums

example program: sin - wave - codec with bsl

Started by markan_b October 22, 2002
Hi,
I am working with TMS320C6711 DSK with CCS 2.10.00
I am trying to send a sine-wave through SPEAKER-OUT ...

and although the following code does not make any errors, it does not
work ...

Do you know, where my problem is ...

Do you have a similar program, that sends and receives data,
especially if it works with BSL-functions ... Please send my any test programs, which run under c6711dsk,
especially those about codec ad535...because I really need help... Thanks in advance
mb

//Source code
===================================================================
#include <bsl.h>/* BSL headers */
#include <csl.h>/* CSL headers */
#include <bsl_ad535.h>/*AD535-Modul-Header */
#include <c6711dsk.h>
/*
#include <c6x.h> // C6000 compiler definitions header
#include <c6x11dsk.h> // C6000 DSK definitions header
*/

#include <csl_mcbsp.h> // Multichannel serial port header
#include "dc_conf.h" #include <math.h> /*um sin() aufrufen zu knen */
#include <stdlib.h /***************************************
* Definitions
****************************************/
#define SAMPLE_FREQ 8000.0
#define SIZE_TABLE 256

/***************************************
* Global variables
****************************************/
double x[SIZE_TABLE];
int lauf;
AD535_Handle hAD535; //handle-variable for codec
//Uint32 controlRegVal3,controlRegVal4,controlRegVal5; AD535_Config my_AD535_Config = { AD535_LOOPBACK_DISABLE,
AD535_MICGAIN_ON,
AD535_GAIN_0DB,
AD535_GAIN_0DB
};
/***************************************
* Functions
****************************************/
void codec_init(void)
{
/* Use BSL routines to open , reset, and configure the codec */
hAD535 = AD535_open(AD535_localId);
AD535_reset(hAD535);
AD535_config(hAD535, &my_AD535_Config);
//MCBSP_setfree(0);
}// END of codec_init() --------------------

void sine_init(void) //initialisiert die tabelle mit werten
{
for(lauf=0;lauf<SIZE_TABLE;lauf++)
x[lauf]=0.0;
for(lauf=0;lauf<SIZE_TABLE;lauf++)
x[lauf]= sin(2*PI*lauf/SIZE_TABLE);
}// END of sine_init() --------------------

/*######################################
* Main routine -----------------------
######################################*/
void main()
{
/* Local variables */ /* Initialize the chip support library, required */
CSL_init();

/* Initialize the board support library, required */
BSL_init();

/* Open and configure the local codec */
codec_init();
/*zum Nachpren, wie Controlregister d. Codec eingestellt sind*/
/* controlRegVal3535_readReg(hAD535, AD535_REG_CTRL3);
controlRegVal4535_readReg(hAD535, AD535_REG_CTRL4);
controlRegVal5535_readReg(hAD535, AD535_REG_CTRL5);
*/

sine_init();
/*loop forever writing sinwave */
while(1)
{
for(lauf=0;lauf<SIZE_TABLE;lauf++)
AD535_write(hAD535,(int)(32000*x[lauf]) );
}

/*######################################
* END of Main routine -----------------
######################################*/ }//END of main()
======================================================================
======================================================================

Thanks in advance

mb