C PROGRAM TO IMPLEMENT FIR FILTER
#1

Code:
#include "xyzcfg.h"

#include "dsk6713.h"
#include "dsk6713_aic23.h"

float filter_Coeff[] ={0.000000,-0.001591,-0.002423,0.000000,0.005728,
0.011139,0.010502,-0.000000,-0.018003,-0.033416,-0.031505,0.000000,
0.063010,0.144802,0.220534,0.262448,0.220534,0.144802,0.063010,0.000000,
-0.031505,-0.033416,-0.018003,-0.000000,0.010502,0.011139,0.005728,
0.000000,-0.002423,-0.001591,0.000000 };

static short in_buffer[100];

DSK6713_AIC23_Config config = {\
    0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Leftline 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 */   \
};
/*

*  main() - Main code routine, initializes BSL and generates tone
*/

void main()
{
    DSK6713_AIC23_CodecHandle hCodec;
  
    Uint32 l_input, r_input,l_output, r_output;
    
    /* Initialize the board support library, must be called first */
    DSK6713_init();
    
    /* Start the codec */
    hCodec = DSK6713_AIC23_openCodec(0, &config);
        
    DSK6713_AIC23_setFreq(hCodec, 1);
    
       while(1)
        {    /* Read a sample to the left channel */
            while (!DSK6713_AIC23_read(hCodec, &l_input));
            
            /* Read a sample to the right channel */
            while (!DSK6713_AIC23_read(hCodec, &r_input));          
                
                l_output=(Int16)FIR_FILTER(&filter_Coeff ,l_input);
                 r_output=l_output;
            
            /* Send a sample to the left channel */
            while (!DSK6713_AIC23_write(hCodec, l_output));

            /* Send a sample to the right channel */
            while (!DSK6713_AIC23_write(hCodec, r_output));
        }
       /* Close the codec */
    DSK6713_AIC23_closeCodec(hCodec);
}
signed int FIR_FILTER(float * h, signed int x)
{
int i=0;
signed long output=0;
in_buffer[0] = x;  /* new input at buffer[0]  */
for(i=51;i>0;i--)
in_buffer[i] = in_buffer[i-1]; /* shuffle the buffer   */
for(i=0;i<51;i++)
output = output + h[i] * in_buffer[i];
return(output);

}

HOW TO PROCEED:
1. Connect a Signal Generator/audio input to the LINE IN Socket or connect a microphone to the MIC IN Socket.
Note:- To use microphone input change the analog audio path control register value (Register no. 4) in Codec Configuration settings of the Source file (Fir.c) from 0x0011 to 0x0015.
[attachment=13343]
2. Connect CRO/Desktop Speakers to the Socket Provided for LINE OUT or connect a headphone to the Headphone out Socket.
3. Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
4. Use the Debug  Connect menu option to open a debug connection to the DSK board
5. Create a new project with name Fir.pjt.
6. Open the File Menu  new  DSP/BIOS Configuration select
“dsk6713.cdb” and save it as “xyz.cdb”
[attachment=13344]
7. Add “xyz.cdb” to the current project.
Project Add files to project xyz.cdb
8. Automatically three files are added in the Generated file folder in project pane
xyzcfg.cmd Command and linking file
xyzcfg.s62  optimized assembly code for configuration
xyzcfg_c.c  Chip support initialization
9. Open the File Menu  new  Source file
10. Type the code in editor window. Save the file in project folder. (Eg: Codec.c).
Important note: Save your source code with preferred language extension. For ASM codes save the file as code(.asm) For C and C++ codes code (*.c,*.cpp) respectively.
11. Add the saved “Fir.c” file to the current project which has the main function and calls all the other necessary routines.
Project  Add files to Project  Codec.c
12. Add the library file “dsk6713bsl.lib” to the current project
Path  “C:\CCStudio_v3.1\C6000\dsk6713\lib\dsk6713bsl.lib”
13. Copy header files “dsk6713.h” and “dsk6713_aic23.h” from and paste it in current project folder.
C:\CCStudio_v3.1\C6000\dsk6713\include.
14. Add the header file generated within xyzcfg_c.c to Fir.c
Note:- Double click on xyzcfg_c.c Copy the first line header (eg.xyzcfg.h) and paste that in source file (eg.Fir.c).
15. Compile the program using the ‘Project-compile’ pull down menu or by
Clicking the shortcut icon on the left side of program window.
16. Build the program using the ‘Project-Build’ pull down menu or by clicking the shortcut icon on the left side of program window.
17. Load the program (Codec.out) in program memory of DSP chip using the
‘File-load program’ pull down menu.
18. Debug Run

MATLAB GENERATED FREQUENCY RESPONSE
High Pass FIR filter(Fc= 800Hz)
.
[attachment=13345]
[attachment=13346]
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: fir filter c, program to implement deadlock using java, program to implement datalink layer framing methods, fir filter in verilog code, vhdl code for fir filter using booth algorithm, headphone, fir filter verilog,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  VHDL program for Booth’s Multiplier smart paper boy 2 5,625 20-04-2013, 11:59 AM
Last Post: T
  Program in “LEX” to count number of vowels and consonants seminar class 2 9,596 22-03-2013, 10:20 AM
Last Post: computer topic
  Program in “LEX” to count number of Identifiers and Keywords seminar class 1 4,822 28-01-2013, 03:21 PM
Last Post: Guest
  Implement DES Algorithm smart paper boy 1 3,910 16-02-2012, 12:34 PM
Last Post: seminar paper
  PROGRAM TO RECOGNIZE A STRING WITH THREE COSECUTIVE 0’s smart paper boy 0 1,653 10-08-2011, 11:44 AM
Last Post: smart paper boy
  : PROGRAM TO IDENTIFY VOWELS AND CONSONANTS GIVEN AS INPUT smart paper boy 0 2,390 10-08-2011, 11:44 AM
Last Post: smart paper boy
  Program to Encrypt and decrypt a text data using RSA algorithm smart paper boy 0 2,513 10-08-2011, 11:43 AM
Last Post: smart paper boy
  : Implement Diijkstra’s algorithm to compute the shortest path through a graph smart paper boy 0 1,343 10-08-2011, 11:42 AM
Last Post: smart paper boy
  Program the CRC 12 on a data set of characters smart paper boy 0 1,758 10-08-2011, 11:42 AM
Last Post: smart paper boy
  Program to implement the data link layer framing method character stuffing smart paper boy 0 7,934 10-08-2011, 11:41 AM
Last Post: smart paper boy

Forum Jump: