i am not able to see proper sine wave after debugging my program for sine wave.why it is so? what changes required to get expected output/perfect sine wave after debugging.
code used:
#include <math.h>
#include "C:\Users\abhi\Downloads\DSK6713\DSK6713\c6000\dsk6713\include\dsk6713.h"
#include "C:\Users\abhi\Downloads\DSK6713\DSK6713\c6000\dsk6713\include\dsk6713_aic23.h"
#define SINE_TABLE_SIZE 96
#define PI ( ( double )3.1415927 )
#define SINE_MAX 0x7FFE //Peak value of sine wave
int sinetable[SINE_TABLE_SIZE];
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00ff, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00ff, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */ \
0x0043, /* 7 DSK6713_AIC23_DIGIF Digital audio interface format */ \
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */ \
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
void InitSineTable( void )
{
int i;
double increment= 0;
double radian = 0;
increment = ( PI * 2 ) / SINE_TABLE_SIZE;
for ( i = 0 ; i < SINE_TABLE_SIZE ; i++ )
{
sinetable[i] = ( int )( sin( radian ) * SINE_MAX );
radian += increment;
}
}
void main()
{
int i;
DSK6713_AIC23_CodecHandle hCodec;
DSK6713_init();
InitSineTable();
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 7); //Sampling rate 96 kHz
while(1)
{
for ( i = 0 ; i < SINE_TABLE_SIZE ; i++ )
{
while (!DSK6713_AIC23_write(hCodec, sinetable[i]));
while (!DSK6713_AIC23_write(hCodec, sinetable[i]));
}
}
}
expected output and actual output are attached.
why i do not find proper sinewave? have i chosen right window for graph display?
7183.actual output.doc0336.expected output.doc1638.actual output graph.doc
thank you