dsp lab fair record (model)

33
DIGITAL SIGNAL PROCESSING LAB RECORD INTRODUCTION TO TMS320C6713 DSK The C6713 DSK builds on TI’s industry-leading line of low cost, easy-to-use DSP Starter Kit (DSK) development boards. The high performance board features the TMS320C6713 floating point DSP, capable of performing 1350 million floating point operations per second(MFLOPS) , the C6713 DSP makes the C6713 DSK the most powerful DSK development board. The DSK is USB port interfaced platform that allows efficiently develop and testing applications for C6713. The DSK consists of a C6713-based printed circuit board that will serve as a hardware reference design for TI’s customer’s product s. With the extensive host PC and target DSP software support, including bundled TI tools, the DSK provides ease-of -use and capabilities that are attractive to DSP engineers. The C6713 DSK has a TMS 320C6713 DSP onboard that allows full speed verification of the Code Composer Studio. The C6713 DSK provides A USB interface SDRAM and ROM An analog interface circuit for data conversion (AIC) An I/O port Embedded JTAG emulation support Connectors on the C6713 DSK provide DSP external memory interface (EMIF) and peripheral signals that enable its functionality to be expanded with custom or third party daughter boards. Dept. of Electronics & Communication Engg. Page No: 1 SCT College of Engineering Pappanamcode-18

Upload: nandagopal-sivakumar

Post on 22-Nov-2014

547 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

INTRODUCTION TO TMS320C6713 DSK

The C6713 DSK builds on TI’s industry-leading line of low cost, easy-to-use DSP Starter Kit (DSK) development boards. The high performance board features the TMS320C6713 floating point DSP, capable of performing 1350 million floating point operations per second(MFLOPS) , the C6713 DSP makes the C6713 DSK the most powerful DSK development board.

The DSK is USB port interfaced platform that allows efficiently develop and testing applications for C6713. The DSK consists of a C6713-based printed circuit board that will serve as a hardware reference design for TI’s customer’s product s. With the extensive host PC and target DSP software support, including bundled TI tools, the DSK provides ease-of -use and capabilities that are attractive to DSP engineers.

The C6713 DSK has a TMS 320C6713 DSP onboard that allows full speed verification of the Code Composer Studio. The C6713 DSK provides

A USB interface

SDRAM and ROM

An analog interface circuit for data conversion (AIC)

An I/O port

Embedded JTAG emulation support

Connectors on the C6713 DSK provide DSP external memory interface (EMIF) and peripheral signals that enable its functionality to be expanded with custom or third party daughter boards.

The DSK provides a C6713 hardware reference design that can assist in the development of C6713 based products. In addition to providing a reference for interfacing the DSP to various types of memories and peripheral interfaces, the design also address power, clock, JTAG and parallel peripheral interfaces.

Dept. of Electronics & Communication Engg. Page No: 1SCT College of EngineeringPappanamcode-18

Page 2: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

The C6713 DSK includes a stereo codec. The analog interface circuit (AIC) has the

following characteristics:

High performance Stereo Codec

90 dB SNR Multibit Sigma –Delta ADC (A- weighted at 48kHz)

100 dB SNR Multibit Sigma Delta DAC (A- weighted at 48kHz)

1.42 V – 3.6 V Core Digital Supply: compatible With TI C54x DSP Core

Voltages

2.7 V – 3.6 V Buffer and Analog Supply: Compatible with both TI C54x DSP

Buffer Voltages

8 kHz – 96 KHz Sampling Frequency Support

Software Control via TI McBSP –Compatible Multiprotocol Serial Port

12 C compatible and SPI – compatible Serial Port Protocols

Glueless Interface to TI McBSP's

Audio- Data Input/Output via TI McBSP- Compatible Programmable Audio Interface

12 S- compatible interface requiring only one McBSP for both ADC and DAC

Standard 12S MSB or LSB justified – Data Transfers

16/20/24/32- Bit Word Length

FEATURES OF C6713 DSK

Dept. of Electronics & Communication Engg. Page No: 2SCT College of EngineeringPappanamcode-18

Page 3: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

The 6713 DSK is a low-cost standalone development platform that enables customers to evaluate and develop applications for the TI C67XX DSP family. The DSP also serves as a hardware reference design for the TMS320C6713 DSP. Schematics, logic equations and application notes are available to ease hardware development and reduce time to market.

The DSK uses the 32bit EMIF for the SDRAM (CE0) and daughtercard expansion interface ( CE2 and CE3). The Flash is attached to CE1 of the EMIF in 8-bit mode. An on-board AIC23 codec allows the DSP to transmit and receive analog signals. McBSP0 is used for the codec control interface and McBSP1 is used for data. Analog audio I/O is done through four 3.5mm audio jacks that correspond to microphone input, line input, line output and headphone output. The codec can select the microphone or line input as the active input. The analog output is driven to both the line out (fixed gain) and headphone (adjustable gain) connectors. McBSP1 can be rerouted to the expansion connectors in software.

A programmable logic device called CPLD is used to implement glue logic that ties the board components together. The CPLD has a register based user interface the lets the user configure the board by reading and writing to the CPLD registers. The registers reside at the midpoint of CE1.

The DSK include 4 LEDs and 4 DIP switches as a simple way to provide the user with interactive feedback. Both are accessed by the reading and writing to the CPLD register.

An included 5V external power supply is used to power is used to power the board. On-board voltage regulators provide 1.26V DSP core voltage, 3.3V digital and 3.3V analog voltages. A voltage supervisor monitors the internally generated voltage and will hold the board in reset until the supplies are within operating specifications and the reset button is released. If desired, JP1 and JP2 can be used as power test points the core and I/O power supplies.

Code Composer communicates with the DSP through an embedded JTAG emulator with a USB host interface. The DSK can also be used with an external emulator through the external JTAG connector.

Dept. of Electronics & Communication Engg. Page No: 3SCT College of EngineeringPappanamcode-18

Page 4: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Dept. of Electronics & Communication Engg. Page No: 4SCT College of EngineeringPappanamcode-18

Page 5: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

INTRODUCTION TO CODE COMPOSER STUDIO

Code Composer is the DSP industry’s first fully integrated development environment (IDE) with DSP- specific functionality. With a familiar environment like MS- based C++, Code composer lets you edit, build, debug, profile and manage projects from a single unified environment. Other unique features include graphical signal analysis, injection/extraction of data signals via file I/O, multi-processor debugging, automated testing and customization via a C-interpretive scripting languages and much more. CODE COMPOSER FEATURE INCLUDES:

IDE

Debug IDE

Advanced watch windows

Integrated editor

File I/O, probe points and graphical algorithm scope probes

Advanced graphical signal analysis

Interactive profiling

Automated testing and customization via scripting

Visual project management system

Compile in the background while editing and debugging

Multi-processor debugging

Help on the target DSP

PROCEDURE TO WORK ON CODE COMPOSER STUDIO

Dept. of Electronics & Communication Engg. Page No: 5SCT College of EngineeringPappanamcode-18

Page 6: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

1. To create a new project

Project → New

2. To create source fileFile → New → Source fileSave the source file in project folder

File → Save

3. To add source file to the project

Dept. of Electronics & Communication Engg. Page No: 6SCT College of EngineeringPappanamcode-18

Page 7: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Project → Add files to project→ <source file>

4. To add rts6700.lib & hello.cmd

Project → Add files to project → rts6700.libPath : C:\CCstudio\c6000\lib\rts6700.libNote: Select Object & library files (*.o, *.l) in Type of file

Project → Add files to project → hello.cmdPath: C:\CCstudio\tutorial\dsk6713\hello1\hello.cmd

Note: Select Linker command file (*.cmd) in Type of file

Dept. of Electronics & Communication Engg. Page No: 7SCT College of EngineeringPappanamcode-18

Page 8: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

5. To compile

Project → Compile file ( or use icon or ctrl+F7 )

6. To build or link

Project→ build (or use F7 )

(which will create a .out file in project folder)

7. To load the program:

File → Load Program → <select the .out file in debug folder in project folder>

8. To run the program

Debug → Run ( or use icon or F5)

Dept. of Electronics & Communication Engg. Page No: 8SCT College of EngineeringPappanamcode-18

Page 9: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

To perform Single Step Debugging:

1. Keep the cursor on the line from point to start single step debugging.

To set the break point click icon from tool bar menu.

2. Load the .out file onto the target

3. Go to View and select Watch window

4. Select Debug → Run (F5)

5. Execution should halt at break point

6. Now press F10. See the changes happening the watch window

7. Similarly go to view & select CPU registers to view the changes happening in

CPU registers.

8. Repeat steps 2 to 6

Experiment: 1

Dept. of Electronics & Communication Engg. Page No: 9SCT College of EngineeringPappanamcode-18

Page 10: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Sine Wave

AIM

To generate a sine wave using C6713 simulator.

PROCEDURE

1. Open Code Composer Setup and select c6713 simulator, click save & quit.2. Start a new project using ‘Project → New’ pull down menu, save it in a separate

directory (D:\My Projects) with filename sinewave.pjt3. Create a new source file using ‘File → New → Source file’ menu and save it in the

project folder (sinewave.c)4. Add the source file (sinewave.c) to the project

Project→Add files to Project→Select sinewave.c5. Add the linker command file hello.cmd

Project → Add files to Project (path: C:\CCstudio\tutorial\dsk6713\hello\hello.cmd)

6. Add the run time support library file rts6700.lib Project → Add files to Project (path: C\CCStudio\cgtools\lib\rts6700.lib) 7. Compile the program using ‘Project → Compile’ menu or by Ctrl+F7 8. Build the program using ‘Project → Build’ menu or by F7 9. Load the sinewave.out file (from project folder lcconv\Debug) using File →Load Program 10. Run the program using ‘Debug → Run’ or F5 11. To view the output graphically Select View → Graph → Time and Frequency

12. Adjust the graph properties to view the output

PROGRAM

#include <stdio.h> #include <math.h> float a[500]; void main() { int i=0; for(i=0;i<500;i++) { a[i]=sin(2*3.14*500*(i/24000)); }

}

OUTPUT

Dept. of Electronics & Communication Engg. Page No: 10SCT College of EngineeringPappanamcode-18

Page 11: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

RESULT

The sine wave has been obtained.

Experiment: 2

Dept. of Electronics & Communication Engg. Page No: 11SCT College of EngineeringPappanamcode-18

Page 12: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Square WaveAIM

To generate a square wave using C6713 simulator.

PROCEDURE

1. Open Code Composer Setup and select c6713 simulator, click save & quit.2. Start a new project using ‘Project → New’ pull down menu, save it in a separate

directory (D:\My Projects) with filename sinewave.pjt3. Create a new source file using ‘File → New → Source file’ menu and save it in the

project folder (squarewave.c)4. Add the source file (squarewave.c) to the project

Project→Add files to Project→Select squarewave.c5. Add the linker command file hello.cmd

Project → Add files to Project (path: C:\CCstudio\tutorial\dsk6713\hello\hello.cmd)

6. Add the run time support library file rts6700.lib Project → Add files to Project (path: C\CCStudio\cgtools\lib\rts6700.lib) 7. Compile the program using ‘Project → Compile’ menu or by Ctrl+F7 8. Build the program using ‘Project → Build’ menu or by F7 9. Load the squarewave.out file (from project folder lcconv\Debug) using File →Load Program 10. Run the program using ‘Debug → Run’ or F5 11. To view the output graphically Select View → Graph → Time and Frequency

13. Adjust the graph properties to view the output

PROGRAM#include <stdio.h> #include <math.h> float a[1000]; void main() { int i,j=0; int b=5;for(i=0;i<10;i++) { for (j=0;j<=50;j++) { a[(50*i)+j]=b; } b=b*(-1) ; }

}

OUTPUT

Dept. of Electronics & Communication Engg. Page No: 12SCT College of EngineeringPappanamcode-18

Page 13: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

RESULT

The square wave has been obtained.

Experiment: 3

Dept. of Electronics & Communication Engg. Page No: 13SCT College of EngineeringPappanamcode-18

Page 14: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Linear Convolution

AIMTo implement linear convolution using Code Composer Studio.

PROCEDURE

1. Open Code Composer Setup and select C6713 simulator, click save and quit 2. Start a new project using ‘Project → New’ pull down menu, save it in a separate

directory (D:\My projects) with file name lconv.pjt 3. Create a new source file using File → New → Source file menu and save it in the

project folder(linear.c) 4. Add the source file (linear.c) to the project Project → Add files to Project → Select linear.c 5. Add the linker command file hello.cmd Project → Add files to Project (path: C:\CCstudio\tutorial\dsk6713\hello\hello.cmd) 6. Add the run time support library file rts6700.lib Project → Add files to Project (path: C\CCStudio\cgtools\lib\rts6700.lib) 7. Compile the program using ‘Project → Compile’ menu or by Ctrl+F7 8. Build the program using ‘Project → Build’ menu or by F7 9. Load the linear.out file (from project folder lcconv\Debug) using

File → Load Program 10. Run the program using ‘Debug → Run’ or F5 11. To view the output graphically

Select View → Graph → Time and Frequency

PROGRAM

#include<stdio.h> #define LENGTH1 6 #define LENGTH2 4 int x[LENGTH1+LENGTH2-1]={1,2,3,4,5,6,0,0,0}; int h[LENGTH1+LENGTH2-1]={1,2,3,4,0,0,0,0,0}; int y[LENGTH1+LENGTH2-1]; main() { int i=0,j; for(i=0;i<LENGTH1 + LENGTH2-1;i++) { y[i]=0; for(j=0;j<=i;j++)

Dept. of Electronics & Communication Engg. Page No: 14SCT College of EngineeringPappanamcode-18

Page 15: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

y[i]+=x[j]*h[i-j]; } for(i=0;i<LENGTH1 + LENGTH2-1;i++) printf("%d\n",y[i]);

}

OUTPUT

1 4 10 20 30 40 43 38 24

RESULT

The linear convolution is implemented & the convoluted sequence is obtained.

Experiment: 4

Dept. of Electronics & Communication Engg. Page No: 15SCT College of EngineeringPappanamcode-18

Page 16: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Circular Convolution

AIMTo implement circular convolution using Code Composer Studio.

PROCEDURE

1. Open Code Composer Setup and select C6713 simulator, click save and quit 2. Start a new project using ‘Project → New’ pull down menu, save it in a separate

directory (D:\My projects) with file name circonv.pjt 3. Create a new source file using File → New → Source file menu and save it in the

project folder(circular.c) 4. Add the source file (circular.c) to the project Project → Add files to Project → Select circular.c 5. Add the linker command file hello.cmd Project → Add files to Project (path: C:\CCstudio\tutorial\dsk6713\hello\hello.cmd) 6. Add the run time support library file rts6700.lib Project → Add files to Project (path: C\CCStudio\cgtools\lib\rts6700.lib) 7. Compile the program using ‘Project → Compile’ menu or by Ctrl+F7 8. Build the program using ‘Project → Build’ menu or by F7 9. Load the circular.out file (from project folder lcconv\Debug) using

File → Load Program 10. Run the program using ‘Debug → Run’ or F5 11. To view the output graphically

Select View → Graph → Time and Frequency

PROGRAM#include<stdio.h> int m,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],a[30]; void main() { printf("Enter the length of 1st sequence\n"); scanf("%d",&m); printf("Enter the length of 2nd sequence\n"); scanf("%d",&n); printf("Enter the 1st sequence\n"); for(i=0;i<m;i++) scanf("%d",&x[i]); printf("Enter the 2nd sequence\n"); for(j=0;j<n;j++) scanf("%d",&h[j]); if(m-n!=0)

Dept. of Electronics & Communication Engg. Page No: 16SCT College of EngineeringPappanamcode-18

Page 17: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

{ if(m>n) { for(i=n;i<m;i++) h(i)=0; n=m; } for(i=m;i<n;i++) x[i]=0; m=n; } y[0]=0; a[0]=h[0]; for(j=1;j<n;j++) a[j]=h[n-j]; for(i=0;i<n;i++) y[0]+=x[i]*a[i]; for(k=1;k<n;k++) { y[k]=0; for(j=1;j<n;j++) x2[j]=a[j-1]; x2[0]=a[n-1]; for(i=0;i<n;i++) { a[i]=x2[i]; y[k]+=x[i]*x2[i]; } } printf("The circular convolution is \n"); for(i=0;i<n;i++) printf("%d\t",y[i]);

}

OUTPUT

Enter the length of 1st sequence 4 Enter the length of 2nd sequence 4 Enter the 1st sequence 3 2 1 4 Enter the 2nd sequence 1 2 3 4

The circular convolution is 22 24 30 24

RESULT

The circular convolution is implemented & the convoluted sequence is implemented.

Dept. of Electronics & Communication Engg. Page No: 17SCT College of EngineeringPappanamcode-18

Page 18: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Experiment: 5

TMS320C6713 DSK CODEC (TLV320AIC23) CONFIGURATION USING BOARD SUPPORT LIBRARY

AIM

To configure the codec TLV320AIC23 for a talk through program using the board support library.

PREREQUISITES

TMS320C6713 DSP starter kit, PC with Code Composer Studio, CRO, Audio source, Speakers, Signal Generator.

PROCEDURE

1. Connect Speaker to the LINE OUT socket. 2. Connect the line out from the PC to the LINE IN socket. 3. Now switch ON the DSK and bring up Code Composer Studio on PC 4. Create a new project with name codec.pjt 5. From File menu →New →DSP/BIOS Configuration →Select dsk6713.cdb and

save it as “xyz.cdb” 6. Add xyz.cdb to the current project 7. Create a new source file and save it as codec.c 8. Add the source file codec.c to the project 9. Add the library file “dsk6713bsl.lib” to the project ( Path: C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib)

10. Copy files “dsk6713.h” and “dsk6713_aic23.h” to the Project folder 11. Build (F7) and load the program to the DSP Chip ( File →Load Program) 12. Run the program (F5) 13. Give an audio output from the PC and notice the output in the speaker 14. Vary the sampling frequency using the DSK6713_AIC23_SetFreq

PROGRAM

Codec.c #include"xyzcfg.h" #include"dsk6713.h" #include"dsk6713_aic23.h" DSK6713_AIC23_Config config= DSK6713_AIC23_DEFAULTCONFIG; void main() { DSK6713_AIC23_CodecHandle hCodec; int l_input,r_input,l_output,r_output;

Dept. of Electronics & Communication Engg. Page No: 18SCT College of EngineeringPappanamcode-18

Page 19: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

DSK6713_init(); hCodec=DSK6713_AIC23_openCodec(0,&config); DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_48KHZ); while(1) { while(!DSK6713_AIC23_read(hCodec,&l_input)); while(!DSK6713_AIC23_read(hCodec,&r_input)); r_output = r_input; l_output = l_input; while(!DSK6713_AIC23_write(hCodec,l_output)); while(!DSK6713_AIC23_write(hCodec,r_output)); } DSK6713_AIC23_closeCodec(hCodec);

}

RESULT

The Codec TMS320AIC23 Successfully configured using the board support library and output is verified.

Dept. of Electronics & Communication Engg. Page No: 19SCT College of EngineeringPappanamcode-18

Page 20: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Experiment: 6

Sine Wave Using DSK6713

AIM

To generate a real time sine wave using TMS320C6713 DSK.

PROCEDURE

1. Connect CRO to the LINE OUT socket. 2. Now switch ON the DSK and bring up Code Composer Studio on PC 3. Create a new project with name sinewave.pjt 4. From File menu → New → DSP/BIOS Configuration → Select dsk6713.cdb and

save it as “xyz.cdb” 5. Add xyz.cdb to the current project 6. Create a new source file and save it as sinewave.c 7. Add the source file sinewave.c to the project 8. Add the library file “dsk6713bsl.lib” to the project ( Path: C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib) 9. Copy files “dsk6713.h” and “dsk6713_aic23.h” to the Project folder

10. Build (F7) and load the program to the DSP Chip ( File → Load Program) 11. Run the program (F5) 12. Give an output from the PC and notice the output in the CRO

PROGRAM

Sinewave.c

#include "xyzcfg.h" #include "dsk6713.h" #include "dsk6713_aic23.h" #include <stdio.h> #include <math.h> float a[2500],b; DSK6713_AIC23_Config config= DSK6713_AIC23_DEFAULTCONFIG; void main() { int f=2000;int i=0; int arraysize=48000/f;DSK6713_AIC23_CodecHandle hCodec; DSK6713_init();hCodec=DSK6713_AIC23_openCodec(0,&config);

Dept. of Electronics & Communication Engg. Page No: 20SCT College of EngineeringPappanamcode-18

Page 21: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_48KHZ);

for(i=0;i<arraysize;i++){a[i]=sin(2*3.14*f*i/48000);}while(1){for(i=0;i<arraysize;i++){b=10000*a[i];while(!DSK6713_AIC23_write(hCodec,b));while(!DSK6713_AIC23_write(hCodec,b));}}DSK6713_AIC23_closeCodec(hCodec);}

RESULT

The sine wave tone have been successfully generated and obtained through CRO.

Dept. of Electronics & Communication Engg. Page No: 21SCT College of EngineeringPappanamcode-18

Page 22: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Experiment: 7

Advanced Discrete Time Filters (FIR)

AIM

To generate filter coefficients using MATLAB and to implement Audio filter using DSK6713.

PROCEDURE

1. Connect DSO / Spectrum Analyser to the LINE OUT socket.2. Give Sine wave from the Arbitrary Function Generator to the LINE IN socket.3. Now switch ON the DSK and bring up Code Composer Studio on PC4. Create a new project with name firfilter.pjt5. From File menu → New → DSP/BIOS Configuration → Choose “dsk6713.cdb”

from the list and save the configuration as “xyz.cdb” in the same folder as the project.

6. Add xyz.cdb to the current project7. Create a new source file and save it as firfilter.c8. Add the source file firfilter.c to the project9. Add the library file “dsk6713bsl.lib” to the project the path is C:\CCStudio\C6000\

dsk6713\lib\dsk6713bsl.lib 10. Select Menu → Project →Build options Select ‘Compiler’ tab select ‘Preprocessor’

from the given menu to the ‘Include Search’ path text box add path C:\CCStudio\C6000\dsk6713\ include

11. Build (F7) and Compile File (Ctrl+F7) 12. Load the program to the DSP Chip File →Load Program 13. Run the program (F5) 14. Give Sine wave from the Arbitrary Function Generator and output in the DSO/

Spectrum Analyser

Dept. of Electronics & Communication Engg. Page No: 22SCT College of EngineeringPappanamcode-18

Page 23: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Procedure for Generating Filter Coefficients in MATLAB

1. Open Matlab

2. Start → Toolboxes → Filter Design → Filter Design & Analysis Tool

3. Select the filter type and give the order and specifications for the filter and click Design filter

Dept. of Electronics & Communication Engg. Page No: 23SCT College of EngineeringPappanamcode-18

Page 24: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

4. Select menu Targets option select Code Composer Studio (r) IDE

5. Save the configuration as “firfilter.h” in the project folder.

Dept. of Electronics & Communication Engg. Page No: 24SCT College of EngineeringPappanamcode-18

Page 25: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

PROGRAM

#include"xyzcfg.h"#include" firfilter.h"#include"dsk6713.h"#include"dsk6713_aic23.h"#define FIR_ORD 30short fir_filter(Uint32 in,short*in_buff,float*coeff);short x_buff[FIR_ORD+1];DSK6713_AIC23_Config config=DSK6713_AIC23_DEFAULTCONFIG;void main(){DSK6713_AIC23_CodecHandle hCodec;Uint32 l_input,r_input,l_output,r_output;DSK6713_init();hCodec=DSK6713_AIC23_openCodec(0,&config);DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_48KHZ);while(1){while(!DSK6713_AIC23_read(hCodec,&l_input));while(!DSK6713_AIC23_read(hCodec,&r_input));l_output=fir_filter(l_input,x_buff,B);r_output=fir_filter(l_input,x_buff,B);while(!DSK6713_AIC23_write(hCodec,l_output));while(!DSK6713_AIC23_write(hCodec,r_output));}DSK6713_AIC23_closeCodec(hCodec);}short fir_filter(Uint32 in,short*in_buff,float*coeff){int out=0;int i;for(i=FIR_ORD;i>0;i‐‐){in_buff[i]=in_buff[i‐1];out=out+in_buff[i]*coeff[i];}in_buff[0]=in;out=out+in_buff[0]*coeff[0];return out;}

RESULT

The FIR filter has been implemented and the output is verified

Dept. of Electronics & Communication Engg. Page No: 25SCT College of EngineeringPappanamcode-18

Page 26: DSP Lab Fair Record (Model)

DIGITAL SIGNAL PROCESSING LAB RECORD

Dept. of Electronics & Communication Engg. Page No: 26SCT College of EngineeringPappanamcode-18