Dsp320 Experimental Manual

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 236

DSP320 TMS 320XXXX DSP TRAINER

EXPERIMENTAL & SERVICE MANUAL

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

. A MESSAGE FROM

Todays system designers are faced with tomorrows problems. EMBEDED SYSTEM is one of the important subject need to teach while learning electronics. It is our vision to provide you with the product you need for training ensuring lasting reliability & quality.

OUR MOTTO;
- Light years ahead refers to leadership. As leaders in our industry in India, We are totally committed to servicing as the standard against which all are measured in the areas of

Design Quality Value Delivery Support.


We are truly light years ahead of our competition in this area. That means that you our valued customers are guaranteed satisfaction. As you will move through this manual you will quickly discover that We have a complete, truly innovative & superior training products we are so committed to quality that we back our products with a complete comprehensive warranty.

-1-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

SAFETY RULES
Read carefully and follow the instructions mentioned in this manual. This user manual includes all the important points about the installation, use and the maintenance of the product. Keep this manual always with you, for quick reference. After unpacking the product, arrange all the accessories in proper order, so that their integrity is checked with the packing list. Also, ensure that the accessories have no visible damage. Before connecting the power supply to the kit, be sure that the jumpers and the connecting chords are connected correctly, as per the experiment. This kit must be employed only for the use for which it has been conceived, i.e. as educational kit and must be used under the direct survey of expert personnel. Any other use is inadvisable and dangerous too. The manufacturer cannot be considered responsible for eventual damages due to improper, wrong or unreasonable uses. In case of any fault or malfunctioning in the trainer kit, turn off the power supply. Please do not tamper the kit. If you require our service, kindly contact the service centre for technical assistance. The kits are liable to malfunction/under-perform if they are not operated under standard environmental conditions of temperature and humidity.

-2-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

WARRANTY
This kit is warranted against defects in workmanship and materials. Any failure due to defect in either workmanship or material should occur under normal use within a year from the original date of purchase, such failure will be corrected free of charge to the purchaser by repair or replacement of defective part or parts. When the failure is result of users neglect, natural disaster or accident, we would charge for repairs, regardless of the warranty period. The warranty does not cover include perishable items like connecting chords, crystals, etc. and other imported items.

Conditions and Limitations


The warranty is void and inapplicable if the defective product is not brought or sent to our authorized service center or sales outlet within the warranty period. Defective product will be Falcon Electro Tek. Pvt. Ltds sole judgment. The defective product will be replaced with a new one or repaired, without charge or with charge. In the warranty period if the service is needed, the purchaser should get in touch with the service center or the sales outlet. The purchaser should return the product to the service center or the sales outlet at his or her sole expense. The loss and damage in transit will be outside the preview of this warranty. A returned product must be accompanied by a written description of the defects. Type and Model No. of the kit has to be mentioned specifically. We return the product to the purchaser at our expense. In case the warranty does not cover the product on Falcon Electro-Tek Pvt. Ltd.s judgment, we would repair the product after obtaining prior permission from purchaser who would receive an estimate statement about the repairing charges. In such cases, Falcon Electro-Tek Pvt. Ltd. bares the transporting expenses required to send back all the repaired products for the moment, and then repairs and transporting expenses will be charged against the purchaser by the statement of accounts. When the authorized sales agents sell our products, they must notify the purchaser of the warranty contents, but they have no rights to stretch the meaning of original warranty contents or to offer an additional warranty. Falcon Electro-Tek Pvt. Ltd. does not provide any other promise or suggestive warranty and hold no liability for the damage caused by negligence, abnormal use or natural disaster. Falcon Electro-Tek Pvt. Ltd. is not responsible for the damages even if it is notified of above dangers in advance as well. For more special service or overall repairs, maintenance and up gradation of products, be sure to contact our service center or the sales outlet.

-3-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

INDEX
01. Technical Specifications 02. Functional Block 03. Introduction 04. Circuit Diagram 05. Packing List 06. Software Installation 07. Start with CCSTUDIO v5 A. How to create new project and Run that program. B. How to import existing project. 08. Experiment No: 1 Linear convolution. 09. Experiment No: 2 Circular convolution. 10. Experiment No: 3 N- Point DFT of a given sequence. 11. Experiment No: 4 N- Point IDFT of a given sequence 12. Experiment No: 5 Impulse response a)first order system b)second order system 13. Experiment No: 6 Frequency response of system a)Given in Transfer function form b)Given in differential equation form 14. Experiment No: 7 FIR filter 1)To design FIR Low pass filter using windows a) Using rectangular window b) Using triangular window c) Using Kaiser window 2)To design FIR High pass filter using windows a) Using rectangular window b) Using triangular window c) Using Kaiser window 09 10 11 12 18 19 27

41

45

49

53

57

61

67

-4-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

3)To design FIR Band pass filter using windows a) Using rectangular window b) Using triangular window c) Using Kaiser window 15. Experiment No: 8 IIR filter 1)To design IIR Low pass filter a) Butterworth filter b) chebyshev 2)To design IIR High pass filter a) Butterworth filter b) chebyshev 3)To design IIR Low pass filter a) Butterworth filter b) chebyshev 16. Experiment No: 9 Noise remove from sine wave using adaptive filter. 17. Experiment No: 10 Power spectrum density. 18. Experiment No: 11 Generation of sinusoidal wave. a)Generation of sinusoidal wave based on recursive differential equation b)Generation of sinusoidal through filtering 19. Experiment No: 12 DFT of given sequence using DIT & DIF FFT. a)To find DFT (8-POINTS) of given sequence using DIT FFT b)To find DFT (8-POINTS) of given sequence using DIF FFT 20. Experiment No: 13 IFFT of given sequence using DIT & DIF FFT. a)To find IFFT (8-POINTS) of given sequence using DIT FFT b)To find IFFT (8-POINTS) of given sequence using DIF FFT 21. Experiment No: 14 Interpolation process. 22. Experiment No: 15 Decimation process. 23. Experiment No: 16 I/D sampling rate converter. `

73

81

85

91

97

103

107

113

119

-5-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

24. Experiment No: 17 a)Autocorrelation. b)Auto_correlation_summation_property 25. Experiment No: 18 Cross-correlation. 26. Experiment No: 19 To find the FFT of given signal. 27. Experiment No: 20 N-Point FFT. 28. Experiment No: 21 Sampling at 4KHz sampling rate 29. Experiment No: 22 Amplitude modulation 30. Experiment No: 23 FSK modulation 31. Experiment No: 24 Generation of square wave 32. Experiment No: 25 Frequency modulation 33. Experiment No: 26 FIR filter using Fourier series expanstion method 34. Experiment No: 27 Blackman & hamming window filter 35. Experiment No: 28 Digital Image fundamental 36. Experiment No: 29 Image Enhancement 37. Experiment No: 30 Image reconstruction 38. Experiment No: 31 Color Image processing 39. Experiment No: 32 Image compression 40. Experiment No: 33 Image segmentation

127

133

139

143

147

151

159

169

173

181

183

187

191

197

203

209

215

-6-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

41. Experiment No: 34 Morphology Image processing 42. Experiment No: 35 DTMF signal of phone keys

223

227

-7-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

-8-

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

TECHNICAL SPECIFICATIONS
TMS320C6745 DSP320 Features
The DSP features the TMS320C6745 DSP320, a 375 MHz device delivering up to 3648 million instructions per second (MIPs) and 2736 MFLOPS. This DSP generation is designed for applications that require high precision accuracy. The C6745 is based on the TMS320C6000 DSP platform designed to needs of highperforming high-precision applications such as pro-audio, medical and diagnostic. Other hardware features of the TMS320C6745 DSK board include: Embedded JTAG supported via USB TLV320AIC23B programmable stereo codec Two 3.5mm audio jacks for microphone and speaker Expansion for port connector for plug-in modules Power supply : +5V, 12V, GND 8 DIP switches for inputs 8 LED indication for output Provision for manual Reset 4*4 LED matrix Noise generator : White noise generator : Amplitude 0 ~ 5Vpp 20*2 character LCD display. 2 No. 7 segment displays. RTC interface : I2C based RTC section Phone keypad : 0 to 9 digits and *, # characters

Software - Designers can readily target the TMS32C6745 DSP320 through TIs robust and comprehensive Code Composer Studio v5 DSP320 development platform. The tools, which run on Windows 98, Windows 2000 ,Windows XP and Windows 7, allow developers to seamlessly manage projects of any complexity. Code Composer Studio features for the TMS320C6745 DSP320 include:

A complete Integrated Development Environment (IDE), an efficient optimizing C/C++ compiler assembler, linker, debugger, an a advanced editor with Code Maestro technology for faster code creation, data visualization, a profiler and a flexible project manager DSP/BIOS real-time kernel Target error recovery software DSP320 diagnostic tool "Plug-in" ability for third-party software for additional functionality

-9-

Embedded & DSP

GND

RESET

!" -#2"

#2"

POWER SUPPLY

LCD

RTC

DSP320 : TMS 320XXXX DSP Trainer

IN#
L2% L23 L22 L2#

NOISE OUT

L20

L#'

L#&

L#7

PR%

O/P LEDS

FUNCTIONAL BLOCK

- 10 -

OUT#

SW#

NOISE GENERATOR & ADDER


# 2 3

DSP

SWITCHES CODEC

JTAG

%
L# L!

$
L' L#3

&

'

L2

L$

L#0

L#%

L3

L7

L##

L#!

HEADPHONE OUT
L% L& L#2 L#$

MIC IN
LINE OUT LINE IN

7 SEGMENT DISPLAY

KEYPAD

LED MATRIX

FREE I/Os
V-12.0

Embedded & DSP

FALCON

DSP 320 - TMS 320XXXX DSP TRAINER

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

INTRODUCTION
The 6745 DSP320 is a low-cost standalone development platform that enables users to evaluate and develop applications for the TI C67XX DSP family. The DSP also serves as a hardware reference design for the TMS320C6745 DSP. Schematics, logic equations and application notes are available to ease hardware development and reduce time to market. An on-board AIC23 codec allows the DSP to transmit and receive analog signals. SPI is used for the codec control interface and McASP0 is used for data. Analog audio I/O is done through two 3.5mm audio jacks that correspond to microphone input, and headphone output and also line input, line output. The codec can select the microphone or the line input as the active input. The analog output is driven to both the line out (fixed gain) and headphone (adjustable gain) connectors. The DSP320 includes 8 LEDs, 8 DIP switches, 4*4 LED matrix, LCD and Seven segment as a simple way to provide the user with interactive feedback. It also include phone keypad to study DTMF signals. The DSP320 includes Real time clock displayed on LCD to learn RTC and I2C protocol. Code Composer communicates with the DSP through an embedded JTAG emulator with a USB host interface.

- 11 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

CIRCUIT DIAGRAM & DESCRIPTION


1. POWER SUPPLY
12.0 1

Falcon Electro Tek Pvt Ltd


- 12 Embedded & DSP

DSP320

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

2. LEDs, LED MATRIX, SWITCHs, KEYPAD, SEVEN SEGMENT AND LCD


12.0 DSP320 2

- 13 -

Embedded & DSP

Falcon Electro Tek Pvt Ltd

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

3. DSPTMS320C6745
12.0 DSP320 3

- 14 -

Embedded & DSP

Falcon Electro Tek Pvt Ltd

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

4. CODEC, RTC AND FREE I/Os


12.0 4

Falcon Electro Tek Pvt Ltd


- 15 Embedded & DSP

DSP320

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

5. NOISE ADDER
12.0 DSP320 5

- 16 -

Embedded & DSP

Falcon Electro Tek Pvt Ltd

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

6. DSP-Vcc
12.0 6

Falcon Electro Tek Pvt Ltd


- 17 Embedded & DSP

DSP320

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Packing list:
DSP320 Development board Power supply with Power cord USB to JTAG emulator MIC and Head Phone set Patch cords CD containing documents Experimental manual. 1 no. 1 no. 1 no. 1 no. 6 no. 1 no 1 no.

- 18 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

SOFTWARE INSTALLATION
SYSTEM REQUIREMENTS: Higher Pentium and above CPU 6750MB of free hard disk space 1GB of RAM SVGA (800 x 600 ) display Internet Explorer (4.0 or later) or Netscape Navigator (4.7 or later) Local DVD drive

Supported Operating Systems:

Windows 98 Windows 2000 Service Pack 1 Windows Me Windows XP Windows 7

Install Code Composer Studio V5 from DVD : NOTE: Before you install the CCS software, please make sure you are using Administrator privileges and any virus checking software is turned off. The DSP320 board should not be plugged in at this point. 1. Simply insert the DVD into your drive. 2. Double click on ccs_setup_5.2.1.00018.exe from the DVD The following window should appear.

- 19 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Click on I accept the terms of the license agreement button to accept the license. And proceed with Next button for further installation of the software. The following window should appear

You must install software in C drive only, as shown above. Click on Next button. The following window should get

- 20 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Select complete feature set as a type of setup and then click on Next button. The following Emulator selection window should appear.

Here, simply confirm that XDS100v2 usb emulator must be selected. And other by default selection of emulators keep as it is. Click on Next. The following window shold appear.

Click on Next button to proceed further installation. The following window should get

- 21 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Installation is in process. It takes minimum half an hour for installation.

After completing the installation successfully, following window will popup.

Now click on Finish button. The next window should appear.

- 22 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Next the workspace window should appear. Code Composer Studio stores your projects in a folder called a workspace.

Click on Browse button to select the directory where you wish to create your workspace folder. Click on OK button.The following window should appear.

- 23 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

The next is License setup window will popup as shown below Here, you have to select license option as a Free LICENSE as shown in the following window.

Click on Finish button. The following window should appear

- 24 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To verify that the license has installed correctly, simply check the word Licensed at the left side bottom of the above window. After completing above installation successesfully, the following six icons will appear on desktop.

NOTE :- After completing installation and before going to use CCSv5 studio environment just copy and replace the original evmc6747_dsp.gel file with the gel file provided in DVD into the CCS install folder location given below C:\ti\ccsv5\ccs_base\emulation\boards\evmc6747\gel

- 25 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

HARDWARE SETTING
Connect the DSP- 320 to Your PC 1. Connect the supplied USB cable to your PC or laptop. 2. If you plan to connect a microphone, speaker, function generator, DSO, or expansion card these must be plugged in properly before you connect power to the DSP320 board. 3. JTAG cable must be connected to PC and kit before power ON the DSP320 board. The required driver for the emulator is automatically install by computer. 4. Connect the power supply to DSP320 and switch it ON

- 26 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

START WITH CCSTUDIO v5


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 liked MS-based C++TM, 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 Cinterpretive scripting language and much more. CODE COMPOSER FEATURES INCLUDE:

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

A. PROCEDURE TO WORK ON CODE COMPOSER STUDIO: 1. Double click on Code Composer Studio v5 icon which is on desktop.

2. It will open the workspace window as follows.

- 27 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Simply close the above window, now you will get following window.

- 28 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

3. To create a new project, go to Project New CCS Project.Give name to project with location to save project or use default location. Project type must be Executable. Following window should apper.Device family is C6000. The Variant is C674x Floating-point DSP and next to this you have to select EVMC6747. In device connection, select Texas Instruments XDS100v2 USB Emulator. In project templates and example section, you have to select an Empty project. As per shown in below window.

Click on Finish button. It starts creating an empty project. 4. After finishing project creation. Empty Project will appear in left window of software, as shown below.

- 29 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

5. To create a source file. Go to File New source file.

- 30 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

The new sorce file popup window should appear contaning source folder, In Source file section save the file name with extension .c, Select template as a Default C++ source template as shown below:

Click on Finish button. It will create a new source file. 6. The next window will appear where you can write your code and save it. Or you can add existing source file. As per shown below:

- 31 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

7. Now write your c program, as follows

8. For testing your connection with board, bouble click on EVMC6747.ccxml so following window winn appear.

- 32 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

9. Then click on Test connection in above window, so testing window will appear as follows

If above window will appear with this message then your connection is correct, than you can close this window and proceed further. If following window will appear, than than connection may get incorrect. So power off DSP320 board and power it again, and do all processes again till scan-test will be succeeded.

- 33 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

10. After that build your program from Project Build ALL. Following console window will appear. It shows if any error present or not.

11. After that Debug the program. For that double click on Debug icon shown in above window or press F11. So debug process starts as follows.

- 34 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

12. After few second, loading of program is completed that is shown in following window

13. Run program by clicking on RUN icon in above window, program will run completely and give output in colsole window as follows.

- 35 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

14. After completion all program, close debug session by clicking on disconnect icon shown in above window. It will come to previous edit window. 15. After completion of one program close project by, right click on project name and delete as shown below.

16. It will ask for conformation as follows

17. Only click on ok. It will delete project from project exploser only. Dont tick on Delete project content on disk, it will delete all program from computer.

- 36 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

How to import existing project 18. Open CCStudio V5 , as follows

19. Then Go to Project below.

Imort Existing CCS Eclipse Project as per shown

- 37 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Selection of Existing CCS Eclipse project window should appear . As shown below.

Browse to select directory. Selected project will appear in discovered projects section. As per shown below

- 38 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Select and click on ok, in above window, so following window will appear

Click on Finish button. Selected project will automatically imopt into project explorer window present at the left side of software window. As shown below

- 39 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

For debugging and downloading follow the procedure from 10 to 13.

- 40 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.1

- 41 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO: 1
NAME
LINEAR CONVOLUTION

OBJECTIVE
To perform linear convolution for the given sequences

THEORY
Linear Convolution involves the following operations. 1. Folding 2. Multiplication 3. Addition 4. Shifting These operations can be represented by a Mathematical Expression as follows:

x[ ]= Input signal Samples h[ ]= Impulse response co-efficient. y[ ]= Convolution output. n = No. of Input samples h = No. of Impulse response co-efficient. Algorithm to implement C or Assembly program for Convolution: Eg: x[n] = {1, 2, 3, 4} h[k] = {1, 2, 3, 4} ; Values of n & k should be a multiple of 4. If n & k are not multiples of 4, pad with zeros to make multiples of 4 ; Size of output sequence.

Where: n=4, k=4.

r= n+k-1 = 4+4-1 = 7. r= 0 n= 0 x[0]h[0] 1 2 3

1 x[0]h[1] x[1]h[0]

2 x[0]h[2] x[1]h[1] x[2]h[0]

3 x[0]h[3] x[1]h[2] x[2]h[1] x[3]h[0]

4 x[1]h[3] x[2]h[2] x[3]h[1]

x[2]h[3] x[3]h[2]

x[3]h[3]

Output: y[r] = { 1, 4, 10, 20, 25, 24, 16}. NOTE: At the end of input sequences pad n and k no. of zeros
- 42 Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\LINEAR_CONVOLUTION Then debug and run the program.

OUTPUT
In this program x[n]={1,2,3,4,5,6}, & h[n]={1,2,3,4}. So output of linear convolution is y[k]={1,4,10,20,30,40,43,38,24};

To view output graphically, Tools graph single time. Graph setting & graph as follows.

- 43 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 44 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.2

- 45 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO: 2
NAME
CIRCULATION CONVOLUTION

OBJECTIVE
To perform circular convolution for the given sequences

THEORY
Steps for Cyclic Convolution: Steps for cyclic convolution are the same as the usual convolution, except all index calculations are done "mod N" = "on the wheel" . Step1: Plot f[m] and h[m]

Subfigure 1.1 Subfigure 1.2 Step 2: "Spin" h[m] n times Anti Clock Wise (counter-clockwise) to get h[n-m] (i.e. Simply rotate the sequence, h[n], clockwise by n steps)

Figure 2: Step 2 Step 3: Pointwise multiply the f[m] wheel and the h[n-m] wheel. Sum=y[n] Step 4: Repeat for all 0<n<N-1 Example 1: Convolve (n=4)

Subfigure 3.1

Subfigure 3.2

Figure 3: Two discrete-time signals to be convolved.

- 46 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

h[m] =

Figure 4 Multiply f[m] and sum to yield: y[0] =3

h[1m]

Figure 5 Multiply f[m] and sum to yield: y[1] =5

h[2m]

Figure 6 Multiply f[m] and sum to yield: y[2] =3

h[3m]

Figure 7 Multiply f[m] and sum to yield: y[3] =1

- 47 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\CIRCULAR_CONVOLUTION Then debug and run the program. Program ask for input length of 1st sequence, so enter the length of sequence, eg. 4. Program ask for input length of 2ndsequence, so enter the length of sequence, eg. 4. Program ask to enter the first sequence. Eg. 3,2,1,0 Program ask to enter the second sequence. Eg. 1,1,0,0

OUTPUT
In this program x[4]={3,2,1,0}, & h[4]={1,1.0.0} as you enter. So output of circular convolution is y[k]={3,5,3,1};

- 48 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.3

- 49 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO: 3
NAME
N- Point DFT of a given sequence

OBJECTIVE
Computation of N- Point DFT of a given sequence

THEORY
The N point DFT of discrete time signal x[n] is given by the equation j 2kn 1 N -1 N X (k ) = x [ n ] e ; k = 0,1,2,....N - 1 N n =0 Where N is chosen such that N L , where L=length of x[n]. To implement using j 2kn 2kn 2kn C program we use the expression e N = cos j sin and allot N N memory space for real and imaginary parts of the DFT X(k)

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\N_POINT_DFT Then debug and run the program. Program ask for no of points of DFT. Eg. 8(for 8 points DFT) Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]={1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. It enter in program as 1010101010101010

OUTPUT
Input x[n]= {1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. Output X[K]={2.8+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0,0.0+j0.0}.

- 50 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 51 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 52 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.4

- 53 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO: 4
NAME
N- Point IDFT of a given sequence

OBJECTIVE
Computation of N- Point IDFT of a given sequence

THEORY
The N point DFT of discrete time signal x[n] is given by the equation j 2kn 1 N -1 N x ( n) = X [ k ] e ; n = 0,1,2,....N - 1 N k =0 Where N is chosen such that N L , where L=length of x[n]. To implement using j 2kn 2kn 2kn C program we use the expression e N = cos + j sin and allot N N memory space for real and imaginary parts of the IDFT x(n)

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\N_POINT_IDFT Then debug and run the program. Program ask for no of points of IDFT. Eg. 8(for 8 points IDFT) Program ask for values of X[k], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. X[k]={2.8+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j}. It enter in program as 2.8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

OUTPUT
Input x[n]= {2.8+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j, 0+0j}. Output X[K]={1.0+j0.0, 1.0+j0.0, 1.0+j0.0, 1.0+j0.0, 1.0+j0.0, 1.0+j0.0, 1.0+j0.0, 1.0+j0.0}.

- 54 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 55 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 56 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.5

- 57 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:5
NAME
Impulse response.

OBJECTIVE
To find the Impulse response of the given a. First order system. b. Second order system.

THEORY
In signal processing, the impulse response, or impulse response function (IRF), of a dynamic system is its output when presented with a brief input signal, called an impulse. More generally, an impulse response refers to the reaction of any dynamic system in response to some external change. In both cases, the impulse response describes the reaction of the system as a function of time (or possibly as a function of some other independent variable that parameterizes the dynamic behavior of the system). For example, the dynamic system might be a planetary system in orbit around a star; the external influence in this case might be another massive object arriving from elsewhere in the galaxy; the impulse response is the change in the motion of the planetary system caused by interaction with the new object. A linear constant coefficient difference equation representing a first order system is given by y[n] + a1 y[n 1] = b0 x[n] + b1 x[n 1] . A linear constant coefficient difference equation representing a second order system is given by y[n] + b1 y[n 1] + b2 y[n 2] = a 0 x[n] + a1 x[n 1] + a 2 x[n 2]; .PROCEDURE Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For 1st order impulse response. PATH: DSP320_PROGRAMS\ IMPLUSE_RES_OF_1ST_ORDER_ SYSTEM Then debug and run the program.

- 58 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

b. For 2nd order impulse response. PATH: DSP320_PROGRAMS\ IMPLUSE_RES_OF_2ST_ORDER_ SYSTEM Then debug and run the program.

OUTPUT
a. For 1st order impulse response. Hear we assume value of a1=2, b0=2, b1=3, Impulse points are as {1, -1, 3, -9, 27},

b. For 2nd order impulse response. Hear we assume value of a0=0.1311, a1=0.2622, a2=0.1311, b1=-0.7478, b2=0.2722. Impulse points are as {0.131100, 0.360237, 0.364799, 0.174741, 0.031373, 0.024104, -0.026565, -0.013304, -0.002718, 0.001589},

- 59 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 60 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.6

- 61 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:6
NAME
Frequency response of system

OBJECTIVE
To find frequency response of system which is given in a. Transfer function form b. Differential equation form.

THEORY
Frequency response: Frequency response is the quantitative measure of the output spectrum of a system or device in response to a stimulus, and is used to characterize the dynamics of the system. It is a measure of magnitude and phase of the output as a function of frequency, in comparison to the input. In simplest terms, if a sine wave is injected into a system at a given frequency, a linear system will respond at that same frequency with a certain magnitude and a certain phase angle relative to the input. Also for a linear system, doubling the amplitude of the input will double the amplitude of the output. In addition, if the system is time-invariant, then the frequency response also will not vary with time. Two applications of frequency response analysis are related but have different objectives. For an audio system, the objective may be to reproduce the input signal with no distortion. That would require a uniform (flat) magnitude of response up to the bandwidth limitation of the system, with the signal delayed by precisely the same amount of time at all frequencies. That amount of time could be seconds, or weeks or months in the case of recorded media. In contrast, for a feedback apparatus used to control a dynamical system, the objective is to give the closed-loop system improved response as compared to the uncompensated system. The feedback generally needs to respond to system dynamics within a very small number of cycles of oscillation (usually less than one full cycle), and with a definite phase angle relative to the commanded control input. For feedback of sufficient amplification, getting the phase angle wrong can lead to instability for an open-loop stable system, or failure to stabilize a system that is open-loop unstable. Digital filters may be used for both audio systems and feedback control systems, but since the objectives are different, generally the phase characteristics of the filters will be significantly different for the two applications. Transfer function: A mathematical statement that describes the transfer characteristics of a system, subsystem, or equipment.

- 62 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

General transfer function define as

There are two forms of transfer function representation in Matlab. The most obvious is the polynomial form where b(s) G(s) = a(s) = s3 + 4 s2 + 5 s + 6 s2 + 2 s + 3

is entered as two row vectors with the polynomial coefficients entered in the order of ascending powers of s. Differential equation: A differential equation is a mathematical equation for an unknown function of one or several variables that relates the values of the function itself and its derivatives of various orders. Differential equations play a prominent role in engineering, physics, economics, and other disciplines. Differential equation example as follows:

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For frequency response of transfer function: PATH: DSP320_PROGRAMS\ FREQ_RESPONCE_OF_TRANSFER_ FUNCTION Then debug and run the program b. For frequency response of differential equation: PATH:DSP_320PROGRAMS\FREQ_RESPONCE_OF_ DIFFERENTIAL_EQU Then debug and run the program

OUTPUT
a. For frequency response of transfer function Hear assume transfer function as G(s)=1/3*(1+2cos(s)), that can be expose as y(n)=1/3*x(n) + 1/3*x(n-1) + 1/3*x(n+1), assume initial conditions to 0. We generated sample sine wave as a input named as iobuffer.

- 63 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

The frequency resonance of that function named as x1. To view input graphically, Select Tools graph Dual time.

Input Iobuffer graph

- 64 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Fft graph

b. For frequency response of differential equation: Hear assume differential equation y(n)=x(n)-0.072*x(n-1)-y(n-1)1.109*y(n-2). Assume initial conditions to 0. We generated sample sine wave as a input named as iobuffer. The frequency resonance of that function named as x1. To view input graphically, graph Dual time. Select Tools

- 65 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Input iobuffer graph

Frequency resonsnce graph

- 66 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.7

- 67 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:7
NAME
FIR filter.

OBJECTIVE
1. FIR Low pass filter using:a. Rectangular window b. Triangular window c. Kaiser window 2. FIR High pass filter using:a. Rectangular window b. Triangular window c. Kaiser window 3. FIR Band pass filter using:a. Rectangular window b. Triangular window c. Kaiser window

THEORY
Fir filter: The output y of a linear time invariant system is determined by convolving its input signal x with its impulse response b. For a discrete-time FIR filter, the output is a weighted sum of the current and a finite number of previous values of the input. The operation is described by the following equation, which defines the output sequence y[n] in terms of its input sequence x[n]:

where:

x[n] is the input signal, y[n] is the output signal,

- 68 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

bi are the filter coefficients, also known as tap weights, that make up the impulse response, N is the filter order; an Nth-order filter has (N + 1) terms on the right-hand side. The x[n i] in these terms are commonly referred to as taps, based on the structure of a tapped delay line that in many implementations or block diagrams provides the delayed inputs to the multiplication operations. One may speak of a "5th order/6-tap filter", for instance.

Flow chart to find FIR filter:

- 69 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Window design method In the Window Design Method, one designs an ideal IIR filter, then applies a window function to it in the time domain, multiplying the infinite impulse by the window function. This results in the frequency response of the IIR being convolved with the frequency response of the window function. If the ideal response is sufficiently simple, such as rectangular, the result of the convolution can be relatively easy to determine. In fact one usually specifies the desired result first and works backward to determine the appropriate window function parameter(s). Kaiser windows are particularly well-suited for this method because of their closed form specifications. a. Rectangular window.

The rectangular window is sometimes known as a Dirichlet window. It is the simplest window, equivalent to replacing all but N values of a data sequence by zeros, making it appear as though the waveform suddenly turns on and off. Other windows are designed to moderate the sudden changes because discontinuities have undesirable effects on the discretetime Fourier transform (DTFT) and/or the algorithms that produce samples of the DTFT b. Triangular window Triangular window; B=1.33 Triangular window with zero-valued end-points:

With non-zero end-points:

c. Kaiser window A simple approximation of the DPSS window using Bessel functions, discovered by Jim Kaiser.

where I0 is the zero-th order modified Bessel function of the first kind, and usually = 3.

- 70 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Note that:

PROCEDURE:
Connect CRO to the LINE OUT. Connect a Signal Generator to the LINE IN. Switch on the Signal Generator with a sine wave of frequency 100 Hz. and Vp-p=1.0v & vary the frequency. 1. FOR LOW PASS FILTER: a. For fir low pass rectangular window (cutoff 500Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_LP_RECT_500Hz Then debug and run the program b. For fir low pass triangular window (cutoff 1000Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_LP_TRIAN_1000Hz Then debug and run the program C. For fir low pass kaiser window (cutoff 1500Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_LP_KAISER_1500Hz Then debug and run the program 2. FOR HIGH PASS FILTER: a. For fir high pass rectangular window (cufoff 400Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_ HP_RECT_400Hz Then debug and run the program b. For fir high pass triangular window (cutoff 800Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location

- 71 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PATH: DSP320_PROGRAMS\ FIR_ HP_TRIAN_800Hz Then debug and run the program C. For fir high pass triangular window (cutoff 1200Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_ HP_KAISER_1200Hz Then debug and run the program 3. FOR FIR BAND PASS FILTER: a. For fir band pass rectangular window (band of 1KHz--2KHz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_BP_RECT_1K_2KHz Then debug and run the program b. For fir band pass triangular window (band of 0.5KHz1.5KHz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_BP_TRIAN_0_5K_1_5KHz Then debug and run the program C. For fir band pass kaiser window (band of 1KHz--3KHz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FIR_BP_KAISER_1K_3KHz Then debug and run the program

OUTPUT
As we applied sine input through line in, the output will appear as per the filter type on DSO. Output will decrease after the cutoff frequency for low pass filter Output will appear after cutoff frequency for high pass filter. Output will appear in between specified band of frequency for band pass filter.

- 72 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.8

- 73 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:8
NAME
IIR filter.

OBJECTIVE
1. IIR Low pass filter using:a. Butterworth filter b. Chebyshev 2. IIR High pass filter using:a. Butterworth filter b. Chebyshev 3. IIR Band pass filter using:a. Butterworth filter b. Chebyshev

THEORY
Infinite impulse response (IIR) is a property of signal processing systems. Systems with this property are known as IIR systems or, when dealing with filter systems, as IIR filters. IIR systems have an impulse response function that is non-zero over an infinite length of time. This is in contrast to finite impulse response (FIR) filters, which have fixed-duration impulse responses. The simplest analog IIR filter is an RC filter made up of a single resistor (R) feeding into a node shared with a single capacitor (C). This filter has an exponential impulse response characterized by an RC time constant. IIR filters may be implemented as either analog or digital filters. In digital IIR filters, the output feedback is immediately apparent in the equations defining the output. Note that unlike FIR filters, in designing IIR filters it is necessary to carefully consider the "time zero" case[citation needed] in which the outputs of the filter have not yet been clearly defined. Design of digital IIR filters is heavily dependent on that of their analog counterparts because there are plenty of resources, works and straightforward design methods concerning analog feedback filter design while there are hardly any for digital IIR filters. As a result, usually, when a digital IIR filter is going to be implemented, an analog filter (e.g. Chebyshev filter, Butterworth filter, Elliptic filter) is first designed and then is converted to a digital filter by applying discretization techniques such as Bilinear transform or Impulse invariance. Digital filters are often described and implemented in terms of the difference equation that defines how the output signal is related to the input signal:
Embedded & DSP

- 74 -

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

where:

is the feedforward filter order are the feedforward filter coefficients is the feedback filter order are the feedback filter coefficients is the input signal is the output signal.

A more condensed form of the difference equation is:

which, when rearranged, becomes:

To find the transfer function of the filter, we first take the Z-transform of each side of the above equation, where we use the time-shift property to obtain:

We define the transfer function to be:

Considering that in most IIR filter designs coefficient function takes the more traditional form:

is 1, the IIR filter transfer

- 75 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Simple IIR filter block diagram

a. Butterworth filter The Butterworth filter is a type of signal processing filter designed to have as flat a frequency response as possible in the passband so that it is also termed a maximally flat magnitude filter. It was first described in 1930 by the British engineer Stephen Butterworth in his paper entitled "On the Theory of Filter Amplifiers".

- 76 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Butterworth stated that: "An ideal electrical filter should not only completely reject the unwanted frequencies but should also have uniform sensitivity for the wanted frequencies". Such an ideal filter cannot be achieved but Butterworth showed that successively closer approximations were obtained with increasing numbers of filter elements of the right values. At the time, filters generated substantial ripple in the passband, and the choice of component values was highly interactive. Butterworth showed that a low pass filter could be designed whose cutoff frequency was normalized to 1 radian per second and whose frequency response (gain) was

where is the angular frequency in radians per second and n is the number of reactive elements (poles) in the filter b. Chebyshev Chebyshev filters are analog or digital filters having a steeper roll-off and more passband ripple (type I) or stopband ripple (type II) than Butterworth filters. Chebyshev filters have the property that they minimize the error between the idealized and the actual filter characteristic over the range of the filter, but with ripples in the passband. This type of filter is named in honor of Pafnuty Chebyshev because its mathematical characteristics are derived from Chebyshev polynomials. Because of the passband ripple inherent in Chebyshev filters, the ones that have a smoother response in the passband but a more irregular response in the stopband are preferred for some applications. These are the most common Chebyshev filters. The gain (or amplitude) response as a function of angular frequency of the nth-order low-pass filter is

where is the ripple factor, 0 is the cutoff frequency and Tn() is a Chebyshev polynomial of the nth order.

PROCEDURE:
Connect CRO to LINE OUT. Connect a Signal Generator to the LINE IN.

- 77 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Switch on the Signal Generator with a sine wave of frequency 100 Hz. and Vp-p=1.0V & vary frequency. 1. FOR IIR LOW PASS FILTER a. For IIR low pass Butterworth filter (cutoff 800Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_LP_BUTTER_800Hz. Then debug and run the program b. For IIR low pass chebyshev filter (cutoff 1000Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_LP_CHEBY_1000Hz. Then debug and run the program 2. FOR IIR HIGH PASS FILTER a. For IIR high pass Butterworth filter (cutoff 2500Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_HP_BUTTER_2500Hz. Then debug and run the program b. For IIR high pass chebyshev filter (cutoff 1000Hz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_HP_CHEBY_1000Hz. Then debug and run the program 3. FOR IIR BAND PASS FILTER a. For IIR band pass Butterworth filter (band of 1k-2.5kHz ) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_BP_BUTTER_1K_2_5KHz Then debug and run the program b. For IIR band pass chebyshev filter (band of 2k-3kHz) Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ IIR_BP_CHEBY_2K_3KHz. Then debug and run the program

- 78 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

OUTPUT
As we giving applied sine input through line in, the output will appear as per the filter type on DSO. Output will decreasing after the cutoff frequency for low pass filter. Output will appear at the cutoff frequency for high pass filter. Output will appear in between specificfied band.

- 79 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 80 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.9

- 81 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:9
NAME
Noise remove from sine wave using adaptive filter.

OBJECTIVE
Noise removal programs: (i) Add noise above 3kHz and then remove (using adaptive filters) (ii) Interference suppression using 400 Hz tone

THEORY
In the previous experiments involving IIR & FIR filters, the filter coefficients were determined before the start of the experiment and they remained constant. Whereas Adaptive filters are filters whose transfer function coefficients or taps change over time in response to an external error signal. Typical applications of these filters are Equalization, Linear Prediction, Noise Cancellation, Time-Delay Estimation, Non-stationary Channel Estimation, etc. Different types of adaptive filter algorithms are the Kalman adaptive filter algorithm, LMS adaptive filter algorithm and RLS adaptive filter algorithm

where E() is the expected value.

Fig.7.1.Adaptive structure for noise cancellation In the below program, two signals - a desired sinusoidal signal (can be the output of the PC speaker/ signal generator of square/ sine wave of frequency not correlated to 3kHz and not above the fsample/2 of the codec) into the Left

- 82 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

channel and Noise signal of 3KHz into the Right channel of the Line In are given (generally using two signal generators with common ground is sufficient).

PROCEDURE:
Connect CRO to LINE OUT Connect a Signal Generator to IN1 with signal input 400Hz, 1Vpp. Noise added signal will be appear at OUT1. Connect that noisey signal to LINE IN. Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ NOISE_REMOVE_FROM_SINE_WAVE. Then debug and run the program

OUTPUT
As we giving applied noisey sine input through line in, the output will appear as noise free on DSO as follows.

- 83 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 84 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.10

- 85 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:10
NAME
Power spectrum density

OBJECTIVE
Determination of power spectrum of a given signal

THEORY

ALGORITHM TO IMPLEMENT PSD: Step 1 - Select no. of points for FFT(Eg: 64) Step 2 Generate a sine wave of frequency f (eg: 10 Hz with a sampling rate = No. of Points of FFT(eg. 64)) using math library function. Step 3 - Compute the Auto Correlation of Sine wave Step 4 - Take output of auto correlation, apply FFT algorithm . Step 4 - Use Graph option to view the PSD. Step 5 - Repeat Step-1 to 4 for different no. of points & frequencies.

- 86 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ POWER_SPECTRUM_DENSITY Then debug and run the program.

OUTPUT
We generated sample sine wave as a input named as x & auto-correlation of input signal as a iobuffer. The frequency resonance of that iobuffer named as x1. To view input & PSD of graphically, Select Tool graph Dual time

- 87 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Sine wave as a input X

Autocorrelation of input signal as a iobuffer

To view power spectrum graphically, Select Tool graph single time.

- 88 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Frequency resonance of iobuffer X1

- 89 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 90 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.11

- 91 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:11
NAME
Generation of sinusoidal wave

OBJECTIVE
a. Generation of sinusoidal wave based on recursive differential equation. b. Generation of sinusoidal through filtering

THEORY
Differential equation;

Filtering method: One efficient technique is using an IIR filter, making it oscillating by locating its poles in the unit circle of the Argand diagram. A typical 2nd order IIR filter can be established as illustrated in Figure 1.

- 92 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. Using diff equation : PATH: DSP320_PROGRAMS \SINE_USING_DIFF_EQU b. Using filter: PATH: DSP320_PROGRAMS \ SINE_USING_FILTER Then debug and run the program.

OUTPUT
FOR SINE GENARATION USING DIFF EQUATION: We generated sample sine wave as a input named as m Sine wave generated through diff equation is x. To view input & output graphically, Select Tool graph Dual time

- 93 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of reference sine wave

Graph of generated sine wave using differential equation.

Graph setting to see sine wave using filter.

- 94 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Sine wave generated through filter

- 95 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 96 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.12

- 97 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:12
NAME
DFT of given sequence using DIT & DIF FFT

OBJECTIVE
a. To find DFT (8-POINTS) of given sequence using DIT FFT. b. To find DFT (8 POINTS) of given sequence using DIF FFT.

THEORY
Computing the DFT Reviewing the basic DFT formula:

DFT using DIT FFT method:

- 98 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Butterfly diagram of DFT using DIT FFT method

DFT using DIF FFT method:

- 99 -

Embedded & DSP

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Butterfly diagram of DFT using DIF FFT method

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For DFT using DIT FFT : PATH: DSP320_PROGRAMS\ DFT_USING_DIT_FFT Then debug and run the program. Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]={1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. It enter in program as 1010101010101010 b. For DFT using DIF FFT : PATH: DSP320_PROGRAMS\ DFT_USING_DIF_FFT Then debug and run the program. Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]={1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. 1010101010101010 It enter in program as

- 100 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

OUTPUT
Input x[n]= {1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}; for both DIT & DIF FFT algorithm. Output X[K]={8+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0}; for both DIT & DIF-FFT algorithm.

Result of DFT using DIT-FFT methode

Result of DFT using DIF-FFT methode

- 101 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 102 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.13

- 103 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:13
NAME
IFFT of given sequence using DIT & DIF FFT

OBJECTIVE
a. To find IFFT (8-POINTS) of given sequence using DIT FFT. b. To find IFFT (8 POINTS) of given sequence using DIF FFT.

THEORY
Computing the IDFT Reviewing the basic IDFT formula:

IFFT using DIT FFT method: Butter fly diagram

- 104 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

IFFT using DIT FFT method: Butter fly diagram

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For IFFT using DIT FFT : PATH: DSP320_PROGRAMS\ IFFT_USING_DIT_FFT Then debug and run the program. Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]= { 8.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0}. It enter in program as 8000000000000000 b. For IFFT using DIF FFT : PATH: DSP320_PROGRAMS\ IFFT_USING_DIF_FFT Then debug and run the program. Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]= { 8.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0}. 8000000000000000 It enter in program as
- 105 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

OUTPUT
Input x[n]= {8.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0}; for both DIT & DIFFFT algorithm. Output X[K]={ 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j }; for both DIT & DIF-FFT algorithm.

- 106 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.14

- 107 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:14
NAME
Interpolation process

OBJECTIVE
Implementation of Interpolation process

THEORY
In this section the increase of the sample rate by an integer factor L is described. In the following we refer to this process as interpolation.

If we increase the sample rate of a signal we can preserve the full signal content according to the sampling theorem. After the interpolation the signal spectrum repeats only at multiples of the new sample rate L. fs. The interpolation is accomplished by inserting L-1 zeros between successive samples (zeropadding) and using an (ideal) lowpass filter with

The multiplication of a signal with spectrum X(f) with a transfer function H(f) in frequency domain Y(f)=H(f).X(f) corresponds to convolution of the signal in the time domain y(t)=h(t)*x(t). for the zero-padded discrete-time signal x[.] we get

- 108 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

if we substitute k by (m div L).L-n.L we get

where m div L is the integer portion of the division m/l, and m mod L denotes the remainder. For each output value y[m] we therefore multiply and accumulate n samples of the impulse response hL[.] by the corresponding input sample x[.]. note that the samples of the impulse resonance hL[.] are equidistant with spacing L

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ INTERPOLATION_BY_L Then debug and run the program.

OUTPUT
We generated sample sine wave as a input named as x Then it pass through interpolation process, that output named as z To view input graphically, graph single time Select Tool

- 109 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Sample sine wave as a input X

To view interpolation graphically, graph single time Select Tool Graph setting & graph

- 110 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Interpolation graph

- 111 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 112 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.15

- 113 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:15
NAME
Decimation process

OBJECTIVE
Implementation of Decimation process

THEORY
To decrease the sample rate by an integer factor M (decimation) we must first band-limit the signal to fs/(2.M) by the lowpass filter Hm to comply with sampling theorem and keep only every Mth sample. As a result, we loose all signal content above half the target sampling frequency fs/M.

Decimation by factor M

to get the decimated signal we start from an initial phase , which can be chosen arbitrarily, keep every Mth sample and skip all other samples. There exist therefore M different sets of samples, which all represent the same signal

- 114 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ DECIMATION_BY_M Then debug and run the program.

OUTPUT
We generated sample interpolated input named as z1 Then it pass through decimation process, that output named as y1 To view input graphically, Select Tool graph single time.

- 115 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of interpolated input

To view output graphically, single time. Select Tool graph

- 116 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of output after decimation

- 117 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 118 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.16

- 119 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:16
NAME
I/D sampling rate converter.

OBJECTIVE
Implementation of I/D sampling rate converter

THEORY

- 120 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 121 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ I_D_SAMPLING_RATE_CONVERTER Then debug and run the program.

OUTPUT
We generated sample sine wave as a input named as x. Then it pass through interpolation process, that output named as z. Then it pass through decimation process, that output named as z1. Final output i.e. original signal named as y1. To view input graphically, Select Tool graph single time.

- 122 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of sample input

- 123 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view interpolation process graphically, Select Tool graph single time

Graph of interpolation

- 124 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view decimation process graphically, Select Tool graph single time .

Graph of decimation process

- 125 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view final output graphically, Select Tool graph single time

Graph of final output

- 126 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.17

- 127 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:17
NAME
Autocorrelation .

OBJECTIVE
Autocorrelation of a given sequence and verification of its properties.

THEORY
AUTO-CORRELATION Correlation is mathematical technique which indicates whether 2 signals are related and in a precise quantitative way how much they are related. A measure of similarity between a pair of energy signals x[n] and y[n] is given by the cross correlation sequence rxy[l] defined by
rxy [l ] =
n =

x[n] y[n l ]; l = 0,1,2,... .

The parameter l called lag indicates the time shift between the pair. Autocorrelation sequence of x[n] is given by
rxx [l ] =
n =

x[n]x[n l ]; l = 0,1,2,...

PROPERTIES OF AUTO CORRELATION 1. Maximum Value: The magnitude of the autocorrelation function of a wide sense stationary random process at lag m is upper bounded by its value at lag m=0

2. Periodicity: If the autocorrelation function of a WSS random process is such that: Rxx (m0 ) =Rxx ( 0 ) _ for some m0 , then Rxx (m) is periodic with period m0 .Furthermore E[ |x( n ) _ x( n _ m )|^2 ]=0 and x(n) is said to be meansquare periodic. 3. The autocorrelation function of a periodic signal is also periodic:

- 128 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

4. Symmetry: The autocorrelation function of WSS process is a conjugate symmetric function of m: For a real process, the autocorrelation sunction is symmetric: Rxx (m) =Rxx ( m) 5. Mean Square Value: The autocorrelation function of a WSS process at lag, m=0, is equal to the meansquare value of the process: 6. If two random processes x(n) and y(n) are uncorrelated, then the autocorrelation of the sum x(n)=s(n)+w(n) is equal to the sum of the autocorrelations of s(n) and w(n): 7. The mean value: The mean or average value (or d.c.) value of a WSS process is given by:

PROCEDURE
a. Auto correlation of sample sine wave PATH: DSP320_PROGRAMS\ AUTO_CORRELATION Then debug and run the program. b. Auto correlation summation property PATH: DSP320_PROGRAMS\ AUTO_CORRELATION_SUM_ PROPERTY Then debug and run the program. Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location

OUTPUT 1. For auto correlation


We generated sample sine wave as a input named as x. Final output of auto correlation named as z. To view input / output graphically, Select Tool graph Dual time

- 129 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of Input sine wae named as X

Graph of Auto correlation named as Z

- 130 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

2. For auto correlation summation property.


We generated two sample sine waves as a input named as a & b. Summation of a & b stored in c. Auto correlation of a & b named as axx & bxx resp. Auto correlation of summation named as cxx. Sum of Auto correlation axx & bxx stored in sum. So as per property sum of auto correlation is equal to auto correlation of sum, as follows. To view comparison graphically, Select Tool graph Dual time Graph setting & Graph

Graph of autocorrelation of summation of two signals

- 131 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of summation of autocorrectaion of two signals

- 132 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.18

- 133 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:18
NAME
Cross-correlation .

OBJECTIVE
Cross-correlation of a given sequence and verification of its properties.

THEORY
CROSS-CORRELATION Cross Correlation has been introduced in the last experiment. Comparing the equations for the linear convolution and cross correlation we find that
rxy [l ] =
n =

x[n] y[n l ] =

n =

x[n] y[(l n)] = x[l ] y[l ] . i.e., convolving the

reference signal with a folded version of sequence to be shifted (y[n]) results in cross correlation output. (Use fliplr function for folding the sequence for correlation). CROSS-CORRELATION PROPERTIES

- 134 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ CROSS_CORRELATION Then debug and run the program.

OUTPUT
We generated sample sine wave as a input named as x. Then generate noise signal using random function and added with original signal, that is denoted as n Cross-correlation output saved in z variable. To view input graphically, Select Tool graph Dual time Graph setting & Graph

- 135 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Sample sine wave named as X

Sample noise signal as n.

To view cross corelation graphically, Select Tool graph single time

- 136 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph

- 137 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 138 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.19

- 139 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:19
NAME
To find the FFT of given signal.

OBJECTIVE
To find the FFT of given signal and plot .

THEORY
A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex-number arithmetic to group theory and number theory; this article gives an overview of the available techniques and some of their general properties, while the specific algorithms are described in subsidiary articles linked below. A DFT decomposes a sequence of values into components of different frequencies. This operation is useful in many fields (see discrete Fourier transform for properties and applications of the transform) but computing it directly from the definition is often too slow to be practical. An FFT is a way to compute the same result more quickly: computing a DFT of N points in the naive way, using the definition, takes O(N2) arithmetical operations, while an FFT can compute the same result in only O(N log N) operations. The difference in speed can be substantial, especially for long data sets where N may be in the thousands or millionsin practice, the computation time can be reduced by several orders of magnitude in such cases, and the improvement is roughly proportional to N / log(N). This huge improvement made many DFT-based algorithms practical; FFTs are of great importance to a wide variety of applications, from digital signal processing and solving partial differential equations to algorithms for quick multiplication of large integers. The most well known FFT algorithms depend upon the factorization of N, but there are FFTs with O(N log N) complexity for all N, even for prime N. Many FFT algorithms only depend on the fact that is an Nth primitive root of unity, and thus can be applied to analogous transforms over any finite field, such as number-theoretic transforms. Since the inverse DFT is the same as the DFT, but with the opposite sign in the exponent and a 1/N factor, any FFT algorithm can easily be adapted for it.

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on.

- 140 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FFT_OF_GIVEN_1D_SIGNAL Then debug and run the program.

OUTPUT
We generated sample sine wave as a input named as iobuffer. FFT of that signal stored in x1 variable. To view input graphically, Select Tool graph Dual time.

- 141 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Input graph named as iobuffer

Graph of FFT named as X1

- 142 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.20

- 143 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:20
NAME
N-Point FFT.

OBJECTIVE
To find the FFT of given (8 points). .

THEORY
A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex-number arithmetic to group theory and number theory; this article gives an overview of the available techniques and some of their general properties, while the specific algorithms are described in subsidiary articles linked below. A DFT decomposes a sequence of values into components of different frequencies. This operation is useful in many fields (see discrete Fourier transform for properties and applications of the transform) but computing it directly from the definition is often too slow to be practical. An FFT is a way to compute the same result more quickly: computing a DFT of N points in the naive way, using the definition, takes O(N2) arithmetical operations, while an FFT can compute the same result in only O(N log N) operations. The difference in speed can be substantial, especially for long data sets where N may be in the thousands or millionsin practice, the computation time can be reduced by several orders of magnitude in such cases, and the improvement is roughly proportional to N / log(N). This huge improvement made many DFT-based algorithms practical; FFTs are of great importance to a wide variety of applications, from digital signal processing and solving partial differential equations to algorithms for quick multiplication of large integers. The most well known FFT algorithms depend upon the factorization of N, but there are FFTs with O(N log N) complexity for all N, even for prime N. Many FFT algorithms only depend on the fact that is an Nth primitive root of unity, and thus can be applied to analogous transforms over any finite field, such as number-theoretic transforms. Since the inverse DFT is the same as the DFT, but with the opposite sign in the exponent and a 1/N factor, any FFT algorithm can easily be adapted for it.

- 144 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ N_PIONT_FFT Then debug and run the program. Program ask for values of x[N], you have to enter values as 1 st real & 2nd imaginary for all N no of values. Eg. x[N]={1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. It enter in program as 1010101010101010

OUTPUT
Input x[n]= {1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j, 1+0j}. Output X[K]={8.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0, 0.0+j0.0}.

- 145 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 146 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.21

- 147 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:21
NAME
Sampling

OBJECTIVE
Sampling of given signal at 1KHz sampling rate .

THEORY
Sampling can be done for functions varying in space, time, or any other dimension, and similar results are obtained in two or more dimensions. For functions that vary with time, let s(t) be a continuous function to be sampled, and let sampling be performed by measuring the value of the continuous function every T seconds, which is called the sampling interval. Thus, the sampled function is given by the sequence: s(nT), for integer values of n. The sampling frequency or sampling rate fs is defined as the number of samples obtained in one second (samples per second), thus fs = 1/T. Although most of the signal is discarded by the sampling process, it is still generally possible to accurately reconstruct s(t) from the samples if the signal is band-limited. A sufficient condition is that the non-zero portion of its Fourier transform, S(f), be contained within a known frequency region of length fs. When that interval is [-fs/2, fs/2], the applicable reconstruction formula is the Whittaker Shannon interpolation formula. In most sampling systems, that condition is approximated by placing an appropriate low-pass filter (anti-aliasing filter) ahead of the sampler. The frequency fs/2 is called the Nyquist frequency of the sampling system. Without an anti-aliasing filter, frequencies higher than the Nyquist frequency will influence the samples in a way that is misinterpreted by the WhittakerShannon interpolation formula or any similar approximation.

PROCEDURE:
Connect CRO to LINE OUT Connect a Signal Generator to the LINE IN. Switch on the Signal Generator with a sine wave of frequency 100 Hz. and Vp-p=1.0v Open Code Composer Studio, make sure the DSP kit is turned on.
- 148 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ SAMPLING_AT_1KHz Then debug and run the program.

OUTPUT
As we giving applied sine input through line in, the output will appear as per the sampling rate on DSO. Grajually increase frequency and see the output on DSO. Following sample wave form shown below. 1. Input signal 100Hz & sampling 1KHz.

- 149 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 150 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.22

- 151 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:22
NAME
Amplitude modulation

OBJECTIVE
Generate an amplitude modulation having variable modulating and carrier frequency. Observe and verify the theoretical FFT characteristics with the observed ones.

THEORY
In radio communication, a continuous wave radio-frequency signal (a sinusoidal carrier wave) has its amplitude modulated by an audio waveform before transmission. In the frequency domain, amplitude modulation produces a signal with power concentrated at the carrier frequency and two adjacent sidebands. Each sideband is equal in bandwidth to that of the modulating signal, and is a mirror image of the other. Amplitude modulation resulting in two sidebands and a carrier is called "double-sideband amplitude modulation" (DSB-AM). Amplitude modulation is inefficient in power usage; at least two-thirds of the power is concentrated in the carrier signal, which carries no useful information (beyond the fact that a signal is present). To increase transmitter efficiency, the carrier may be suppressed. This produces a reduced-carrier transmission, or DSB "double-sideband suppressed-carrier" (DSB-SC) signal. A suppressed-carrier AM signal is three times more powerefficient than AM. If the carrier is only partially suppressed, a double-sideband reduced-carrier (DSBRC) signal results. For reception, a local oscillator will typically restore the suppressed carrier so the signal can be demodulated with a product detector. Improved bandwidth efficiency is achieved at the expense of increased transmitter and receiver complexity by completely suppressing both the carrier and one of the sidebands. This is single-sideband modulation, widely used in amateur radio and other communications applications. A simple form of AM, often used for digital communications, is on-off keying: a type of amplitude-shift keying in which binary data is represented by the presence or absence of a carrier. This is used by radio amateurs to transmit Morse code and is known as continuous wave (CW) operation. In Amplitude Modulation the amplitude of high frequency sine wave (carrier) is varied in accordance with the instantaneous value of the modulating signal. Consider a sine signal vm(t) with frequency f

- 152 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Vm(t) = B Sin (2f t) And another sine signal vc(t) is called modulating signal, the signal vc(t) is called carrier signal. Vc(t) = A Sin (2F t) The signal vm(t) is called modulating signal; the signal vc(t) is called carrier signal. Vary the amplitude of the carrier vc(t) adding the modulating signal vm(t) to A. You obtain a signal vM(t) amplitude modulated, which can be expressed by: vM(t) = [A+k B sin(2f t)] sin(2F t) = A [1+m sin(2f t)] sin(2F t) With k = constant of proportionality. Percentage modulation signal is defined as the value: m = ----------- 100 A With reference to FIG.1.7, the modulation index m can be calculated in this way H-h m = --------- 100% H +h
KB

- 153 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

SPECTRUM OF THE MODULATED SIGNAL: With simple trigonometric passages, the relation expressing the modulated signal vM becomes: A A vM(t) = A sin(2Ft) + m --- cos[(2(F-f) t] m ---- cos[(2(F+f) t] 2 2 From which we can deduce that the signal modulated in amplitude by a sine modulator consists of three sine components: A sin(2Ft) Carrier A m ---- cos [(2(F-f) t] 2 A m ---- cos [(2(F+f) t] 2 Lower side band

Upper side band

Particularly effective is the representation of the modulated signal into an Amplitude/frequency diagram. FIG.1.8 reports the different components of the AM signal, in the amplitude/frequency diagram as well as the amplitude/time diagram

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ AMPLITUDE_MODULATION
- 154 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Then debug and run the program. Hear program will ask modulating and carrier frequency as follows.

OUTPUT
After completion of program AM wave will shown in graph. To view input graphically, Dual time. Select Tool graph Graph setting & Graph

- 155 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of modulating frequency

Graph of carrier frequency

To view carriar frequency signal graphically, Select Tool graph single time. Graph setting & Graph

- 156 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of AM signal

To view FFT of amplitude modulated signal graphically, Select Tool graph FFT magnitude Graph and graph setting

- 157 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of FFT of AM signal

- 158 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.23

- 159 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:23
NAME
FSK modulation

OBJECTIVE
Generate an FSK wave form for transmitting the digital data of the given bit sequence. Predict and verify the FFT for the same one

THEORY
In frequency-shift keying, the signals transmitted for marks (binary ones) and spaces (binary zeros) are

respectively. This is called a discontinuous phase FSK system, because the phase of the signal is discontinuous at the switching times. A signal of this form can be generated by the following system:

If the bit intervals and the phases of the signals can be determined (usually by the use of a phase-lock loop), then the signal can be decoded by two separate matched filters:

The first filter is matched to the signal s1.t/, and the second to s2.t/. Under the assumption that the signals are mutually orthogonal, the output of one of the matched filters will be E and the other zero (where E is the energy of thesignal). Decoding of the bandpass signal can therefore be achieved by subtracting the outputs of the two filters, and comparing the result to a threshold.If the signal s1.t/ is present then the resulting output will be CE, and if s2.t/ is present it will be E. Since the noise variance at each filter output is E_=2,
- 160 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

the noise in the difference signal will be doubled, namely _ 2D E_. Since the overall output variation is 2E, the probability of error is

The overall performance of a matched filter receiver in this case is therefore the same as for ASK. The frequency spectrum of an FSK signal is difficult to obtain this is a general characteristic of FM signals. However, some rules of thumb can be developed. Consider the case where the binary message consists of an alternating sequence of zeros and ones. If the two frequencies are each multiples of 1=T (eg. f1 D m=T and f2 D n=T ) and are synchronised in phase, then the FSK wave is a periodic function:

This can be viewed as the linear superposition of two OOK signals, one delayed by T seconds with respect to the other. Since the spectrum of an OOK signal is

where M.!/ is the transform of the baseband signal m.t/, the spectrum of the FSK signal is the superposition of two of these spectra, one for !1 D !c 1!and the other for !2 D !c C 1!. An example is shown below for positive frequencies under the assumption that 21f T _ 1:

The bandwidth of the periodic FSK signal is then 21f C 2B, with B the bandwidth of the baseband signal. Nonsynchronous or envelope detection can be performed for FSK signals. In this case the receiver takes the following form:

- 161 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

The bit error probability can be shown to be

which under normal operating conditions corresponds to less than a 1dB penalty over coherent detection. In practice almost all FSK receivers are of thisform.In order for envelope detection to be successful, the peaks in the frequency domain at !c 1! and !c C 1! must be widely separated with respect to the bandwidth of the baseband signal. This requires 21f T > 1. A more practical alternative to discontinuous-phase FSK systems are continuous-phase FSK systems, where a polar binary baseband signal is provided as the input to a voltage-controlled oscillator (VCO):

In this case the FSK signal can be represented by

Overly sharp transitions in the phase of the output signal can be restricted by band-limiting the input to the VCO. Note that FSK is not true frequency modulation, and does not provide the wide-band noise reduction properties associated with FM.

SPECTRUM OF FSK:

- 162 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FSK_MODULATION Then debug and run the program

OUTPUT
Hear we generated sample frequencies 2000Hz & 1000Hz for modulation Give digital data from SW1 from SWITCHS section. After given input data press # key from KEYPAD section. So your selected data will shown in colsole block.

- 163 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view carrier signals graphically, Select Tool graph Dual time Graph setting & graph

Carrier signal frequency (2000hz) graph named as fh

- 164 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Carrier signal frequency (1000hz) graph named as fl

To view scale data and fsk signals graphically, Select Tool graph Dual time.

- 165 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

input data

FSK signal graph

To view FFT of FSK. Select view graph

FFT magnitude

- 166 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

FFT of FSK signal graph

- 167 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 168 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.24

- 169 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:24
NAME
Generation of square wave

OBJECTIVE
Generation of square wave from sine wave and cosine waves with the help of fourier series. Find out coefficient values.

THEORY
The Fourier theorem is fairly general and also applies to periodic functions that have discontinuities and cannot be represented by a single analytic expression. For a periodic function f(x), provided that the following conditions are satisfied (Dirichlet conditions): (a) f(x) is defined and single-valued except (perhaps) at a finite number in (-T, T) (b) f(x) is periodic outside (-T, T) with period 2T, (c) f(x) and f(x) are piecewise continuous in (-T, T), then f(x) can be expressed by the following series:

Where

Although the calculation of a0, a1, b1, a2, b2 is a mathematically straightforward process, it may become rather tedious depending on the complexity and the discontinuities of f(x). The Fourier theorem is particularly useful in scientific instrumentation, where f(x) functions may represent actual periodic signals f(t). Some simple examples of Fourier series are those of square, triangular and sawtooth waveforms:

- 170 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Square waveform

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ SQURE_WAVE_USING_FOURIER_SERIES Then debug and run the program

OUTPUT
Coefficients values are generated and saved in path To view square wave graphically, Select Tool graph single time E:\\coefficient.txt file.

- 171 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Graph of square wave named as fx

- 172 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.25

- 173 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:25
NAME
Frequency modulation

OBJECTIVE
Generate Frequency modulation having carrier frequencies 1 KHz and modulating frequency 200 Hz with the modulation index of 0.7. observe and verify the theoretical FFT characteristics with the observed ones.

THEORY
Frequency Modulation In telecommunications and signal processing, frequency modulation (FM) conveys information over a carrier wave by varying its instantaneous frequency. This contrasts with amplitude modulation, in which the amplitude of the carrier is varied while its frequency remains constant.

If the baseband data signal (the message) to be transmitted is xm(t) and the sinusoidal carrier is , where fc is the carrier's base frequency and Ac is the carrier's amplitude, the modulator combines the carrier with the baseband data signal to get the transmitted signal:

In this equation, is the instantaneous frequency of the oscillator and is the frequency deviation, which represents the maximum shift away from fc in one direction, assuming xm(t) is limited to the range 1. Although it may seem that this limits the frequencies in use to fc f, this neglects the distinction between instantaneous frequency and spectral frequency. The frequency spectrum of an actual FM signal has components extending infinitely, although they become negligible beyond a certain point.

- 174 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Sinusoidal baseband signal Simply stated, a baseband modulated signal may be approximated by a sinusoidal continuous wave signal with a frequency fm. The integral of such a signal is:

In this case, equation (1) above simplifies to:

where the amplitude of the modulating sinusoid is represented by the peak deviation (see frequency deviation). The harmonic distribution of a sine wave carrier modulated by such a sinusoidal signal can be represented with Bessel functions; this provides the basis for a mathematical understanding of frequency modulation in the frequency domain. Modulation index As in other modulation indices, this quantity indicates by how much the modulated variable varies around its unmodulated level. It relates to variations in the carrier frequency:

where is the highest frequency component present in the modulating signal xm(t), and is the peak frequency-deviationi.e. the maximum deviation of the instantaneous frequency from the carrier frequency. If , the modulation is called narrowband FM, and its bandwidth is approximately . If , the modulation is called wideband FM and its bandwidth is approximately . While wideband FM uses more bandwidth, it can improve the signal-to-noise ratio significantly; for example, doubling the value of , while keeping fm constant, results in an eight-fold improvement in the signal-tonoise ratio.[4] (Compare this with Chirp spread spectrum, which uses extremely wide frequency deviations to achieve processing gains comparable to traditional, better-known spread-spectrum modes). With a tone-modulated FM wave, if the modulation frequency is held constant and the modulation index is increased, the (non-negligible) bandwidth of the FM signal increases but the spacing between spectra remains the same; some spectral components decrease in strength as others increase. If the frequency

- 175 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

deviation is held constant and the modulation frequency increased, the spacing between spectra increases. Frequency modulation can be classified as narrowband if the change in the carrier frequency is about the same as the signal frequency, or as wideband if the change in the carrier frequency is much higher (modulation index >1) than the signal frequency. [5] For example, narrowband FM is used for two way radio systems such as Family Radio Service, in which the carrier is allowed to deviate only 2.5 kHz above and below the center frequency with speech signals of no more than 3.5 kHz bandwidth. Wideband FM is used for FM broadcasting, in which music and speech are transmitted with up to 75 kHz deviation from the center frequency and carry audio with up to a 20-kHz bandwidth.

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ FREQUENCY_MODULATION Then debug and run the program

OUTPUT
Hear we have generated carrier of 1KHz & modulating frequency of 200Hz. To view modulating frequency graphically, Select Tool graph Dual time Graph setting & graph

- 176 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Modulating frequency graph named as fm

Carriar frequency

To view frequency modulation graphically, Select Tool graph single time.

- 177 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Frequency modulation graph named as FM

To view FFT of frequency modulation graphically, graph FFT magnitude. Select Tool

- 178 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

FFT of frequency modulation graph

- 179 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 180 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.26

- 181 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:26
NAME
FIR filter using Fourier series expansion method

OBJECTIVE
Design FIR filter using Fourier series expansion method. (cutoff 4000Hz)

THEORY
FIR filters are filters having a transfer function of a polynomial in z- and is an allzero filter in the sense that the zeroes in the z-plane determine the frequency response Magnitude characteristic. The z transform of a N-point FIR filter is given by

PROCEDURE:
Connect CRO to LINE OUT. Connect a Signal Generator to the LINE IN Socket. Switch on the Signal Generator with a sine wave of frequency 1000 Hz. and Vp-p=1.0v & vary the frequency. Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ LOWPASS_4KHz_USING_FOURIER_ SERIES Then debug and run the program.

OUTPUT
As we applied sine input through line in, the output will appear as per the filter type on DSO. Output will disappear at the cutoff frequency for low pass filter

- 182 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.27

- 183 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:27
NAME
Blackman & hamming window filters

OBJECTIVE
Verify Blackman and Hamming windowing techniques for square wave as an input which window will give good results.

THEORY
Blackman window Blackman windows are defined as:

Hamming window The "raised cosine" with these particular coefficients was proposed by Richard W. Hamming. The window is optimized to minimize the maximum (nearest) side lobe, giving it a height of about one-fifth that of the Hann window, a raised cosine with simpler coefficients.

Note that:

- 184 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE:
Connect CRO to LINE OUT Connect a Signal Generator to the LINE IN Socket Switch on the Signal Generator with a square wave of frequency 1000 Hz. and Vp-p=1.0v & vary the frequency. Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For FIR low pass blackman window(cutoff 2000Hz) PATH: DSP320_PROGRAMS\ FIR_LP_BLACKMAN_2000Hz Then debug and run the program. b. For FIR low pass hamming window(cutoff 2000Hz) PATH: DSP320_PROGRAMS\ FIR_LP_HAMMING_2000Hz Then debug and run the program.

OUTPUT
As we applied sine input through line in, the output will appear as per the filter type on DSO. Output will decresing after the cutoff frequency for low pass filter.

- 185 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 186 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.28

- 187 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:28
NAME
Digital Image fundamentals

OBJECTIVE
1. Study of gray scale Image. 2. Study of colour Image

THEORY
Gray scale Image: Gray levels represent the interval number of quantization in gray scale image processing. At present, the most commonly used storage method is 8-bit storage. There are 256 gray levels in an 8 bit gray scale image, and the intensity of each pixel can have from 0 to 255, with 0 being black and 255 being white we. Another commonly used storage method is 1-bit storage. There are two gray levels, with 0 being black and 1 being white a binary image, which, is frequently used in medical images, is being referred to as binary image . As binary images are easy to operate, other storage format images are often converted into binary images when they are used for enhancement or edge detection.

Color image A (digital) color image is a digital image that includes color information for each pixel. For visually acceptable results, it is necessary (and almost sufficient) to provide three samples (color channels) for each pixel, which are interpreted as coordinates in some color space. The RGB color space is commonly used in computer displays, but other spaces such as YCbCr, HSV, and are often used in other contexts.A color image is usually stored in memory as a raster map, a twodimensional array of small integer triplets; or (rarely) as three separate raster maps, one for each channel.

Separate R, G, and B image layers

- 188 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Eight bits per sample (24 bits per pixel) seem adequate for most uses, but faint banding artifacts may still be visible in some smoothly varying images, especially those subject to processing. Particularly demanding applications may use 10 bits per sample or more. On the other hand, some widely used image file formats and graphics cards may use only 8 bits per pixel, i.e., only 256 different colors, or 23 bits per channel. Converting continuous-tone images like photographs to such formats requires dithering and yields rather grainy and fuzzy results. Graphics cards that support 16 bits per pixel provide 65536 distinct colors, or 56 bits per channel. This resolution seems satisfactory for non-professional uses, even without dithering.

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For Gray scale Image PATH: DSP320_PROGRAMS\ READ_GRAY_SCALE_IMAGE Then debug and run the program. b. For Color Image PATH: DSP320_PROGRAMS\ READ_COLOUR_IMAGE Then debug and run the program.

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena (64*64 pixels) To view out image Select Tool image Analyzer

- 189 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

After completing property go on image right click refersh Gray scale image

To view Gray scale image Image Analyzer Select Tool

After completing property go on image right click refersh. Color image

- 190 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.29

- 191 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:29
NAME
Image Enhancement

OBJECTIVE
1. Image negative. 2. Pow-Low transform

THEORY
Image enhancement: Image enhancement is the improvement of digital image quality (wanted e.g. for visual inspection or for machine analysis), without knowledge about the source of degradation. Image enhancement techniques are used to emphasize and sharpen image features for display and analysis. Image enhancement is the process of applying these techniques to facilitate the development of a solution to a computer imaging problem. Negative: Formula g (x,y) = 255 - f (x,y) A positive image is a normal image. A negative image is a total inversion of a positive image, in which light areas appear dark and vice versa. A negative color image is additionally color reversed, with red areas appearing cyan, greens appearing magenta and blues appearing yellow. This sometimes can have a reverse effect and cause the greens to appear a reddish brown. Power low: A power law is a special kind of mathematical relationship between two quantities. When the frequency of an event varies as a power of some attribute of that event (e.g. its size), the frequency is said to follow a power law. Formula

where C and r are +ve constants As in log transformation, power- law curves with

- 192 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For Gray scale Image PATH: DSP320_PROGRAMS\ IMAGE_NEGATIVE Then debug and run the program. b. For Color Image PATH: DSP320_PROGRAMS\ POW-LOW_TRANSFORMATION Then debug and run the program.

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena To view Original image Select Tool Image Analyzer

After completing property go on image right click refersh

- 193 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view Negative image Select Tool Image Analyzer

After completing property go on image right click refersh

- 194 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view power low transform of image Select Tool Image Analyzer

After completing property go on image right click refersh Power low transform of input image

- 195 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 196 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.30

- 197 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:30
NAME
Image reconstruction

OBJECTIVE
Add noise in Original image & remove it using median filter.

THEORY
Noise Image noise is random (not present in the object imaged) variation of brightness or color information in images, and is usually an aspect of electronic noise. It can be produced by the sensor and circuitry of a scanner or digital camera. Image noise can also originate in film grain and in the unavoidable shot noise of an ideal photon detector. Image noise is an undesirable by-product of image capture that adds spurious and extraneous information. Salt and paper noise An image containing salt-and-pepper noise will have dark pixels in bright regions and bright pixels in dark regions. This type of noise can be caused by analog-todigital converter errors, bit errors in transmission, etc. Dead pixels in an LCD monitor produce a similar, but non-random, display. Median Filter The median filter is also a sliding-window spatial filter, but it replaces the center value in the window with the median of all the pixel values in the window. As for the mean filter, the kernel is usually square but can be any shape. An example of median filtering of a single 3x3 window of values is shown below. Unfiltered image Median filter

in order: 0, 2, 3, 3, 4, 6, 10, 15, 97


- 198 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Center value (previously 97) is replaced by the median of all nine values (4).

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ NOISE_REDUCTION Then debug and run the program

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena And added salt and paper noise to it Then use Median filter to remove noise To view Original image Select Tool Image Analyzer

After completing property go on image right click refersh

- 199 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view Noisy image Select Tool Image Analyzer

After completing property go on image right click refersh

To view Reconstructed image Select Tool Image Analyzer

- 200 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

After completing property go on image right click refersh

- 201 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 202 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.31

- 203 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:31
NAME
Color Image processing

OBJECTIVE
Pseudocolor image processing

THEORY
Pseudocolor (false color) image processing Pseudocolor (false color) image processing consists of assigning colors to gray values based on a specified criterion. The term pseudocolor emphasizes that the colors were assigned artificially opposing to the true (real) colors. The principal use of pseudocolors is for human visualization and interpretation of gray scale details on an image or their sequence A pseudo-color image is derived from a greyscale image by mapping each pixel value to a color according to a table or function. Pseudo-coloring can be used to store the results of image elaboration; that is, changing the colors in order to ease understanding the image. Alternatively, depending on the table or function used, pseudo-coloring may increase the information contents of the original image, for example adding geographic information, combining information obtained from infra-red or ultra-violet light, or MRI scans.

Methods to pseudocolor image processing Intensity (density) slicing The technique of intensity (density) slicing can be explained by interpreting a grayscale image as a 3D function being sliced by a plane parallel to the coordinate plane of the image. For instance, a plane at li slices the image into two levels. Assigning next one color to the pixels, whose intensities are above the plane and another pixels color to the pixels, whose intensities are below the plane (pixels are on different sides of the plane), we create a two-color image, whose appearance depends on pixel intensities.

- 204 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Intensity to color transformation Other types of intensity-to-color transformations exist. One practically attractive method implies performing three independent transformations on the intensity of any input pixel. The results are fed separately into the red green and blue monitor red, green, channels producing a composite image whose colors are modulated by the transformation functions.

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ GRAY_TO_COLOUR_IMAGE_ CONVERTOR Then debug and run the program
- 205 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena Then 0 to 256 intencity pixel asine to RED colour & 85 to 256 intencity pixel value asine to Green & 170 to 256 intencity pixel value asine to Blue To view Original image Image Analyzer Select Tool

After completing property go on image right click refersh In image

- 206 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view color image Select Tool Image Analyzer

After completing property go on image right click refersh

- 207 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 208 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.32

- 209 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:32
NAME
Image compression

OBJECTIVE
Image compression using Huffman coding

THEORY
Huffman coding Huffman encoding, an algorithm for the lossless compression of files based on the frequency of occurrence of a symbol in the file that is being compressed. The Huffman algorithm is based on statistical coding, which means that the probability of a symbol has a direct bearing on the length of its representation. The more probable the occurrence of a symbol is, the shorter will be its bit-size representation. In any file, certain characters are used more than others. Using binary representation, the number of bits required to represent each character depends upon the number of characters that have to be represented. Using one bit we can represent two characters, i.e., 0 represents the first character and 1 represents the second character. Using two bits we can represent four characters, and so on. Unlike ASCII code, which is a fixed-length code using seven bits per character, Huffman compression is a variable-length coding system that assigns smaller codes for more frequently used characters and larger codes for less frequently used characters in order to reduce the size of files being compressed and transferred. The basic idea in Huffman coding is to assign short codewords to those input blocks with high probabilities and long codewords to those with low probabilities. This concept is similar to that of the Morse code. A Huffman code is designed by merging together the two least probable characters, and repeating this process until there is only one character remaining. A code tree is thus generated and the Huffman code is obtained from the labeling of the code tree. An example of how this is done is shown below.

- 210 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

It does not matter how the characters are arranged. I have arranged it above so that the final code tree looks nice and neat. It does not matter how the final code tree are labeled (with 0s and 1s). I chose to label the upper branches with 0s and the lower branches with 1s. There may be cases where there is a tie for the two least probable characters. In such cases, any tie-breaking procedure is acceptable. Huffman codes are not unique. Huffman codes are optimal in the sense that no other lossless fixed-tovariable length code has a lower average rate. The rate of the above code is 2.94 bits/character. The entropy lower bound is 2.88 bits/character.

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ HUFFMAN_CODING Then debug and run the program

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena Then we calculate frequency of same pixel value & asine new values from 0 to 256 as per occurance. To view Original image Select Tool Image Analyzer

- 211 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

After completing property go on image right click refersh In image

To view compressed image Select Tool Image Analyzer

- 212 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

After completing property go on image right click refersh

- 213 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 214 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.33

- 215 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:33
NAME
Image segmentation

OBJECTIVE
Edge detection using sobel operator

THEORY
Segmentation In computer vision, segmentation is the process of partitioning a digital image into multiple segments (sets of pixels, also known as superpixels). The goal of segmentation is to simplify and/or change the representation of an image into something that is more meaningful and easier to analyze.[1] Image segmentation is typically used to locate objects and boundaries (lines, curves, etc.) in images. More precisely, image segmentation is the process of assigning a label to every pixel in an image such that pixels with the same label share certain visual characteristics. The result of image segmentation is a set of segments that collectively cover the entire image, or a set of contours extracted from the image (see edge detection). Each of the pixels in a region are similar with respect to some characteristic or computed property, such as color, intensity, or texture. Adjacent regions are significantly different with respect to the same characteristic(s).[1] When applied to a stack of images, typical in Medical imaging, the resulting contours after image segmentation can be used to create 3D reconstructions with the help of interpolation algorithms like Marching cubes. Edge detection Edge detection is a fundamental tool in image processing and computer vision, particularly in the areas of feature detection and feature extraction, which aim at identifying points in a digital image at which the image brightness changes sharply or, more formally, has discontinuities. The same problem of finding discontinuities in 1D signals is known as step detection. Edge detection techniques Sobel Operator The operator consists of a pair of 33 convolution kernels as shown in Figure 1. One kernel is simply the other rotated by 90.

- 216 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

These kernels are designed to respond maximally to edges running vertically and horizontally relative to the pixel grid, one kernel for each of the two perpendicular orientations. The kernels can be applied separately to the input image, to produce separate measurements of the gradient component in each orientation (call these Gx and Gy). These can then be combined together to find the absolute magnitude of the gradient at each point and the orientation of that gradient. The gradient magnitude is given by: Typically, an approximate magnitude is computed using: which is much faster to compute. The angle of orientation of the edge (relative to the pixel grid) giving rise to the spatial gradient is given by:

Roberts cross operator: The Roberts Cross operator performs a simple, quick to compute, 2-D spatial gradient measurement on an image. Pixel values at each point in the output represent the estimated absolute magnitude of the spatial gradient of the input image at that point. The operator consists of a pair of 22 convolution kernels as shown in Figure. One kernel is simply the other rotated by 90. This is very similar to the Sobel operator.

These kernels are designed to respond maximally to edges running at 45 to the pixel grid, one kernel for each of the two perpendicular orientations. The kernels can be applied separately to the input image, to produce separate measurements of the gradient component in each orientation (call these Gx and Gy). These can then be combined together to find the absolute magnitude of the gradient at each point and the orientation of that gradient. The gradient magnitude is given by:

- 217 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

although typically, an approximate magnitude is computed using:

which is much faster to compute. The angle of orientation of the edge giving rise to the spatial gradient (relative to the pixel grid orientation) is given by:

Prewitts operator: Prewitt operator is similar to the Sobel operator and is used for detecting vertical and horizontal edges in images.

Laplacian of Gaussian: The Laplacian is a 2-D isotropic measure of the 2nd spatial derivative of an image. The Laplacian of an image highlights regions of rapid intensity change and is therefore often used for edge detection. The Laplacian is often applied to an image that has first been smoothed with something approximating a Gaussian Smoothing filter in order to reduce its sensitivity to noise. The operator normally takes a single graylevel image as input and produces another graylevel image as output. The Laplacian L(x,y) of an image with pixel intensity values I(x,y) is given by:

Since the input image is represented as a set of discrete pixels, we have to find a discrete convolution kernel that can approximate the second derivatives in the definition of the Laplacian. Three commonly used small kernels are shown in Figure

- 218 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ EDGE_DETECTION Then debug and run the program

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena Then we apply sobel oparetor for edge detection. To view Original image Image Analyzer Select Tool

After completing property go on image right click refersh

- 219 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view edge of image Select Tool Image Analyzer

After completing property go on image right click refersh

- 220 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.34

- 221 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:34
NAME
Morphology Image Processing

OBJECTIVE
Prefom Dilation & Erosion operation on binary Image.

THEORY
Morphology Morphology as a tool for extracting image components that are useful in the representation and description of region shape, such as boundaries, skeletons, etc. We are also interested in morphological techniques for pre- and postprocessing, such as morphological filtering, thinning, and pruning. Dilation/Erosion First, define A as the reference image and B is the structure image used to process A. Dilation is defined by the equation:

Where B is B rotated about the origin. Dilation has many uses but a major one is bridging gaps in an image due to the fact that B is expanding the features of A. Dilation on the other hand can be considered a narrowing of features on an image. Again defining A as the reference image and B as the structure image: Many times dilation can be used for removing irrelevant data from an image.

Erosion(b) and dilation(c) of image (a) Source


- 222 DSP Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

PROCEDURE:
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location a. For Image Negative PATH: DSP320_PROGRAMS\ DILATION Then debug and run the program b. For Power-Low Transformation PATH: DSP320_PROGRAMS\ EROSION Then debug and run the program

OUTPUT
Hear we have generated pixel values from MATLAB for image of Lena To view Binary image Select Tool Image Analyzer

After completing property go on image right click refersh

- 223 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

To view Dilation image Select Tool Image Analyzer

After completing property go on image right click refersh

To view Erosion image Select Tool Image Analyzer

- 224 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

After completing property go on image right click refersh

- 225 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

- 226 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO.35

- 227 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

EXPERIMENT NO:35
NAME
DTMF.

OBJECTIVE
1. Genaration of DTMF signal. 2. Spectrogram of DTMF signal. .

THEORY
DTMF stands for Dual Tone - Multi Frequency and it is the basis for your telephone system. DTMF is actually the generic term for Touch-Tone (touch-tone is a registered trademark of ATT). Your touch-tone phone is technically a DTMF generator that produces DTMF tones as you press the buttons. How does it work? When you press the buttons on the keypad, a connection is made that generates two tones at the same time. A "Row" tone and a "Column" tone. These two tones identify the key you pressed to any equipment you are controlling. If the keypad is on your phone, the telephone company's "Central Office" equipment knows what numbers you are dialing by these tones, and will switch your call accordingly. If you are using a DTMF keypad to remotely control equipment, the tones can identify what unit you want to control, as well as which unique function you want it to perform.

When you press the digit 1 on the keypad, you generate the tones 1209 Hz and 697 Hz.

- 228 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

Pressing the digit 2 will generate the tones 1336 Hz and 697 Hz. Sure, the tone 697 is the same for both digits, but it take two tones to make a digit and the decoding equipment knows the difference between the 1209 Hz that would complete the digit 1, and a 1336 Hz that completes a digit 2. What are "Mark" and "Space" ? Mark and Space refer to the duration a Dtmf tone is produced, as well as the duration of the silence between individual digits.

PROCEDURE
Open Code Composer Studio, make sure the DSP kit is turned on. Import program using Project import Existing ccs Eclipe project. Which is saved in DVD at following location PATH: DSP320_PROGRAMS\ DTMF_SIGNAL_OF_PRESSED_KEY Then debug and Run program Press any key from KEYPAD section and see DTMF signal

- 229 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

OUTPUT
Hear we generated sample frequencies for row and column as per standard. To view DTMF signal graphically, single time. Select Tool graph

a. DTMF signal at key1

- 230 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

b. DTMF signal at key 2

c. DTMF signal at key 3

d. DTMF signal at key 4

- 231 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

e. DTMF signal at key 5

f. DTMF signal at key 6

g. DTMF signal at key 7

- 232 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

h. DTMF signal at key 8

i.

DTMF signal at key 9

j.

DTMF signal at STAR key

- 233 DSP

Embedded &

DSP320 : TMS 320XXXX DSP Trainer

V-12.0

k. DTMF signal at key 0

l.

DTMF signal at key #

- 234 DSP

Embedded &

You might also like