Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

some help with DSP (Digital Signal Processor)

Status
Not open for further replies.

kamil khoury

Newbie level 3
Joined
Mar 9, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,311
Can anyone provide me with these two codes (it's really important to me):
a. a code to generate a square wave (by an unstable filter) using DSP.
b. a code to generate a triangular wave (by an unstable filter) using DSP.

thank you so much for help :)

the following code generates a sine wave in the same way (I don't know if this code can help) :

#include "Config1cfg.h"
#include "dsk6713_aic23.h"
#include "dsk6713.h"
#include "math.h"

/* Codec configuration settings */
DSK6713_AIC23_Config config = {
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00d8, /* 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 main()
{
DSK6713_AIC23_CodecHandle hCodec;


/* Start the codec */

float u0=1;
int i,n;
float size=10000;
float y[10000];
float fs=16000, ts=(1/fs),f=1300;
float a= 2*cos(360*f*ts), b=-1 , c=sin(360*f*ts);


y[2]=0;
y[1]=2;
y[0]=3;


for(n=2;n<size;n++)
{
y[n]=a*y[n-1]+b*y[n-2]+c*u0;
u0=0;
}

/* Initialize the board support library, must be called first */
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config);
for (i = 0; i < size; i++)
{
/* Send a sample to the left channel */
while (!DSK6713_AIC23_write(hCodec,(Int16)y));

/* Send a sample to the right channel */
while (!DSK6713_AIC23_write(hCodec, (Int16)y));
}

DSK6713_AIC23_closeCodec(hCodec);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top