You are on page 1of 123

SUDHARSAN ENGINEERING COLLEGE Sathiyamangalam.

LAB MANUAL

Subject Class !an"le" By

: Ec1309 Digital Signal Laboratory : EEE : Mr#$#M#Sent%il&u'ar ( S#B%u)anes*ari

Ex. No:1 Date:

GENERATION OF BASIC SIGNALS

Aim: To plot the basic signals in discrete time (DT) form using MAT A! in a single page. 1) "nit step signal #) "nit impulse signal $) "nit ramp signal %) "nit exponential signal a. &ro'ing exponential b. deca(ing exponential )) *inusoidal signal +) ,osine signal Requirements: 1. -ersonnel ,omputer #. MAT A! *oft'are Algorithm: 1) Enter the range of the unit step signal &enerate the step signal as defined b( u (n) . 1/ n0 0/ n10 #) Enter the range of the 2mpulse signal. &enerate the impulse signal as defined b( 3 (n) . 1/ 0/ $) Enter the range of the ramp signal. &enerate the ramp signal as defined b( r (n) . n/ 0/ %) Enter the range of the exponential signal &enerate the exponential signal as defined b( ( (n) . a4n 1. 5or gro'ing exponential a61 #. 5or deca(ing exponential a11 n 0 n10 n .0 n 0

)) &enerate the sinusoidal signal as defined b( s (n) . A sin (#7pi7f7t) +) &enerate the cosine signal as defined b( s (n) . A cos (#7pi7f7t)8 'here A is the amplitude of the signal. a. Unit Step Signal

Program: clc/ clear all/ close all/ a.input (9Enter the range9)/ n.:a: 1: a/ (. ;<eros (a8 1)/ ones (a=18 1)>/ disp(()/ stem (()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9"nit step signal9)/

Input: Enter the range: % Output: 0 0 0 0 1 1 1 1 1

b. Unit Impulse Signal:

Program: clc/ clear all/ close all/ a.input (9Enter the range9)/ n.:a: 1: a/ (. ;<eros (a8 1)/ ones (18 1)/ <eros (a8 1)>/ disp(()/ stem (n8 ()/ xlabel (9samples9)/ (label (9Amplitude9)/ title (9"nit impulse signal9)/

Input: Enter the range: % Output: 0 0 0 0 1 0 0 0 0

c# Unit Ramp signal:

Program: clc/ clear all/ close all/ a.input (9Enter the range9)/ for ;n.:a: 1: a>/ ( (n=a=18 1) .n/ end/ n.:a: 1: a/ disp(()/ stem (n8 ()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9"nit ramp signal9)/

Input: Enter the range: % Output: :% :$ :# :1 0 1 # $ %

d# Exponential signal: i) Growing Exponential Signal: Program: clc/ clear all/ close all/ b.input (9Enter the range9)/ a.input (9Enter the constant (a61)9)/ for (n.:b: 1: b)/ ( (18 n=b=1) .a4n/ end/ n.:b: 1: b/ disp(()/ stem (n8 ()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9&ro'ing exponential signal9)/

Input: Enter the range: % Enter the constant (a61):# Output: ,olumns 1 through ) 0.0+#) 0.1#)0 0.#)00 0.)000 1.0000

,olumns + through ? #.0000 %.0000 @.0000 1+.0000

d. Exponential Signal: ii) Decaying Exponential Signal: Program: clc/ clear all/ close all/ b.input(9Enter the range9)/ a.input(9Enter the constant(a11)9)/ for(n.:b:1:b)/ ((18n=b=1).a4n/ end/ n.:b:1:b/ disp(()/ stem(n8()/ xlabel(9*amples9)/ (label(9Amplitudes9)/ title(9Deca(ing exponential signal9)/

Input: Enter the range: % Enter the constant(a11): 0.# Output: ,olumns 1 through ) +#).0000 1#).0000 #).0000 ,olumns + through ? 0.#000 0.0%00 0.00@0 0.001+ ).0000 1.0000

e. Sinusoidal signal:

Program: clc/ clear all/ close all/ a.input (9Enter the amplitude9)/ f.input (9Enter the freAuenc(9)/ t.0:0.1:#7pi/ (.a7sin (#7pi7f7t)/ subplot (#8181)/ plot (t8()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9,ontinuous time signal9)/ subplot (#818#)/ stem (t8()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9Discrete time signal9)/

Input: Enter the maximum freAuenc(: .) Enter the sampling freAuenc(: 10 Enter the sampling factor: # Output:

f. Cosine signal:

Program: clc/ clear all/ close all/ a.input (9Enter the amplitude9)/ f.input (9Enter the freAuenc(9)/ t.0:0.1:#7pi/ (.a7cos (#7pi7f7t)/ subplot (#8181)/ plot (t8()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9,ontinuous time signal9)/ subplot (#818#)/ stem (t8()/ xlabel (9*amples9)/ (label (9Amplitudes9)/ title (9Discrete time signal9)/

Input: Enter the amplitude: % Enter the freAuenc(: 0.# Output:

Result: Thus the basic signals 'ere generated and plotted using MAT A! program.

DISCRETE CONVOLUTION
Ex. No:# Date:
Aim: To find and plot the discrete conBolution of t'o seAuences using MAT A! program. a) inear ,onBolution b) ,ircular ,onBolution Requirements: 1. -, #. MAT A! *oft'are Algorithm: a) Linear Convolution: 1. &et the t'o input seAuences x1(n) and x#(n) in matrix form. #. -erform the linear conBolution b( the formula8 ((n) . C x1(D) x#(n:D) $. ,hecD the length of the conBolBed signal b( the formula N$.N1=N#:18'here N1 is the length of x1(n) and N# is the length of x#(n). %. Displa( the output ). -lot the input and conBolBed seAuences. b) Circular Convolution 1. &et the t'o input seAuences (n) and h (n) in matrix form. #. ,hecD for eAual length seAuences. 2f it is eAual perform circular conBolution8 other'ise conBert it into eAual length seAuences b( adding <eros. $. Ebtain the maximum length of the t'o seAuences. This giBes the length of the circular conBolBed seAuence. %. Ebtain the difference bet'een the t'o seAuence length8 i.e. n$.n1:n#8 'here n1 is length of g (n) and n# is length of h (n). ). Add n$ <eros 'ith smaller seAuence. +. ,alculate the circular conBolution b( matrix method. F. Displa( the output

@. -lot the input and conBolBed seAuences. a. Linear convolution:

Program: clc/ clear all/ close all/ x.input (9Enter the input seAuence :9)/ h.input (9Enter the impulse seAuence :9)/ (.conB(x8 h)/ subplot ($8#81)/ stem(x)/ xlabel (9n9)/ (label (9x(n)9)/ title (92nput seAuence9)/ subplot ($8#8#)/ stem (h)/ xlabel (9n9)/ (label (9h(n)9)/ title (92mpulse seAuence9)/ subplot ($818$)/ *tem(()/ xlabel (9n9)/ (label (9((n)9)/ title (9linear conBolution9)/

Input: Enter the input seAuence: ;% $ # 1> Enter the impulse seAuence: ;1 # $> Output:

b. Circular convolution: Program: clc/ clear all/ close all/ x1.input(9Enter the first seAuence:9)/ x#.input(9Enter the second seAuence:9)/ n.length(x1)/ m.length(x#)/ if (n6m)/ for (n.m=1:1:n)/ x#(18n).0/ end/ else (n1m)/ for (n.n=1)/ x1(18n)/ end/ end/ (D.fft(x1).7fft(x#)/ (.ifft ((D)/ subplot ($8#81)/ *tem(x1)/ xlabel (9n9)/ (label (9x1(n)9)/ title (9first seAuence9)/ subplot ($8#8#)/ stem (x#)/ xlabel (9n9)/ (label (9x#(n)9)/ title (9second seAuence9)/ subplot ($818$)/ stem (()/ xlabel (9n9)/ (label (9((n)9)/

title (9circular conBolution9)/ Input: Enter the first seAuence: ;1 # $ %> Enter the second seAuence: ;# $ )> Output:

Result: Thus the discrete conBolution of t'o seAuences 'as found and plotted using MAT A! program.

FAST FOURIER TRANSFORM


Ex. No:$ Date:
Aim: To find the 5ast 5ourier transform of the giBen input seAuence using MAT A! commands. Requirements: 1. -, #. MAT A! *oft'are Algorithm: FF 1. Enter the input seAuence and the length of the input seAuence. #. &et the output seAuences using 55T formula. $. Displa( the output %. -lot magnitude response and phase response of output seAuence Algorithm: IFF 1. Enter the input seAuence and the length of the input seAuence. #. &et the output seAuence using 255T formula $. Displa( the output %. -lot magnitude response of input seAuence and phase response of output seAuence

Fast Fourier trans!orms: Program: clc/ clear all/ close all/ xn.input(9Enter the input seAuence:9)/ N.length(xn)/ for(D.0:1:N:1) sum.0/ for(n.0:1:N:1) sum.sum=(xn(18n=1)7exp(:i7#7pi7n7DGN))/ end/ xD(18D=1).sum/ end/ subplot($8#81)/ stem(xn)/ xlabel(9n9)/ (label(9Magnitude9)/ title(92nput seAuence9)/ subplot($8#8#)/ stem(abs(xD))/ disp(abs(xD))/ xlabel(9n9)/ (label(9Magnitude9)/ title(9Magnitude response of 55T9)/ subplot($818$)/ stem(angle(xD))/ disp(angle(xD)) xlabel(9n9)/ (label(9-hase9)/

title(9-hase response of 55T9)/

Input: Enter the input seAuence: ;# $ % )> Output: 1%.0000 #.@#@% #.0000 #.@#@%

#.$)+# :$.1%1+ :#.$)+#

Inverse Fast Fourier trans!orms: Program: clc/ clear all/ close all/ xD.input(9Enter the input seAuence:9)/ N.length (xD)/ for (n.0:1:N:1) sum.0/ for (D.0:1:N:1) sum.sum=(xD(18D=1)7exp(i7#7pi7n7DGN)GN)/ end/ xn(18n=1).sum/ end/ subplot ($8#81)/ stem (abs(xD))/ disp (abs(xD))/ xlabel (9n9)/ (label (9Magnitude9)/ title (9Magnitude response of 55T9)/ subplot ($8#8#)/ stem (angle(xD))/ disp (angle(xD)) xlabel (9n9)/ (label (9-hase9)/ title (9-hase response of 55T9)/ subplot ($818$)/ stem (abs(xn))/ disp (abs(xn))/ xlabel (9n9)/ (label (9Magnitude9)/

title (92nBerse 5ast 5ourier Transform9)/ Input: Enter the input seAuence:;1% :#=#i :# :#:#i> Output: 1%.0000 0 # #.@#@% #.0000 #.@#@%

#.$)+# $

$.1%1+ :#.$)+# % )

Result: Thus the 5ast 5ourier transform and 2nBerse 5ast 5ourier transform of t'o seAuences 'as found and output 'as plotted using MAT A!.

Ex. No:% Date:

SAMPLING and effect of aliasing

Aim: To sample the sinusoidal signal and sho' the effect of aliasing on sampled signal b( follo'ing methods a. "p sampling b. Do'n sampling using MAT A! program. Requirements: 1) -, #) MAT A! *oft'are Algorithm: a) Up ampling: 1. Enter the maximum freAuenc(. #. Enter the sampling freAuenc(. $. Enter the sampling factor. %. -lot the sinusoidal 'aBeform using formula sin (#7pi7fm7t). ). -lot the up sampled 'aBeform using formula up sample () b) Down ampling: 1. Enter the maximum freAuenc(. #. Enter the sampling freAuenc(. $. Enter the sampling factor. %. -lot the sinusoidal 'aBeform using formula sin (#7pi7fm7t). ). -lot the do'n sampled 'aBeform using formula do'n sample ()

a. Up sampling "#ithout Aliasing $:

Program: clc; clear all; close all; m!in"#t$%Enter the ma&im#m re'#ency(%); s!in"#t$%Enter the sam"ling re'#ency(%); s!in"#t $%Enter the sam"ling actor (%); t!*(1+ s( ,-"i; y!sin $,-"i- m-t); s#."lot $,/1/1); "lot $t/y); &la.el $%t01%); yla.el $%y01%); title $%signal to .e sam"le2(%); y1!#" sam"le$y/s); s#."lot $,/1/,); stem $y1); &la.el $%t01%); yla.el $%y01%); title $%sam"le 3itho#t aliasing%);

Input: Enter the maximum freAuenc(: .% Enter the sampling freAuenc(: 10 Enter the sampling factor: % Output:

b. %o&n sampling "#ith Aliasing$:

Program: clc/ clear all/ close all/ fm.input(9Enter the maximum freAuenc(:9)/ fs.input(9Enter the sampling freAuenc(:9)/ s.input (9Enter the sampling factor :9)/ t.0:1Gfs:#7pi/ (.sin (#7pi7fm7t)/ subplot (#8181)/ plot (t8()/ xlabel (9t:69)/ (label (9(:69)/ title (9signal to be sampled:9)/ (1.do'n sample((8s)/ subplot (#818#)/ stem ((1)/ xlabel (9t:69)/ (label (9(:69)/ title (9sample 'ith aliasing9)/

Input: Enter the maximum freAuenc(: 0.) Enter the sampling freAuenc(: 10 Enter the sampling factor: ) Output:

Result: Thus the sinusoidal signal 'as sampled and its effect of aliasing 'as sho'n b( up sampling and do'n sampling methods using MAT A! program.

DESIGN OF FIR FILTER


Ex. No:) Date:
Aim: To design 52H lo' pass8 high pass8 bandpass and band stop filters b( follo'ing techniAues a. Hectangular 'indo' b. Iamming 'indo' c. Jaiser 'indo' Requirements: 1) -, #) MAT A! soft'are Algorithm: a) !ectangular win"ow 1. Enter the number of samples #. 5ind the 'indo' coefficients $. 5ind the finite impulse response of the all filters. %. -lot the magnitude response of all filters. b) #amming win"ow 1. Enter the number of samples #. 5ind the 'indo' coefficients $. 5ind the finite impulse response of the all filters. %. -lot the magnitude response of all filters. c) $ai er win"ow 1. &et the pass band and stop band ripples. #. &et the pass band and stop band edge freAuencies. $. &et the sampling freAuenc(. %. &et the beta Balue. ). ,alculate the order of the filter

+. 5ind the 'indo' coefficients. F. -lot the magnitude response a. Rectangular #indo&: Program:
clc/ clear all/ close all/ N.input (9Enter the number of samples :9)/ 'c..#7pi/ n.0:1 :( N:1)/ alp. (N:1)G#/ '.0:.01: pi/ eps.0.001/ 'r.boxcar(N)/ K o' pass filter hd.;sin('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'r9/ h<.freA< (hn818')/ subplot (#8#81)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9 o' pass filter9)/ KIigh pass filter hd.;sin(pi7(n:alp=eps)):sin('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'r9/ h<.freA< (hn818')/

subplot (#8#8#)/ plot ('8#07log (abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9Iigh pass filter9)/ K!and pass filter 'c1..#)7pi/ 'c#..F)7pi/ hd.;sin('c#7(n:alp=eps)):sin('c17(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'r9/ h<.freA< (hn818')/ subplot (#8#8$)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9!and pass filter9)/ K!and stop filter hd.;sin('c17(n:alp=eps)):sin('c#7(n:alp=eps))=sin(pi7(n:alp=eps))>.G(pi7(n: alp=eps))/ hn.hd.7'r9/ h<.freA< (hn818')/ subplot (#8#8%)/ plot ('8#07log (abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9!and stop filter9)/

Input: Enter the number of samples: #) Output:

b. 'amming #indo&: Program:


clc/ clear all/ close all/ N.input (9Enter the number of samples:9)/ 'c..#7pi/ n.0:1 :( N:1)/ alp.(N:1)G#/ '.0:.01: pi/ eps.0.001/ 'h.hamming(N)/ K o' pass filter hd.;sin ('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'h9/ h<.freA< (hn818')/ subplot (#8#81)/ plot ('8#07log (abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9 o' pass filter9)/ KIigh pass filter hd.;sin(pi7(n:alp=eps)):sin('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'h9/ h<.freA< (hn818')/ subplot (#8#8#)/

plot ('8#07log (abs(h<)))/

xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9Iigh pass filter9)/ K!and pass filter 'c1..#)7pi/ 'c#..F)7pi/ hd.;sin('c#7(n:alp=eps)):sin('c17(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'h9/ h<.freA< (hn818')/ subplot (#8#8$)/ plot ('8#07log (abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9!and pass filter9)/ K!and stop filter hd.;sin('c17(n:alp=eps)):sin('c#7(n:alp=eps))=sin(pi7(n:alp=eps))>.G(pi7(n: alp=eps))/ hn.hd.7'h9/ h<.freA< (hn818')/ subplot (#8#8%)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title( 9!and stop filter9)/

Input: Enter the number of samples: #) Output:

c. (aiser #indo&: Program: clc/ clear all/ close all/ rp.input(9Enter the pass band ripple:9)/ rs.input(9Enter the stop band ripple:9)/ 'p.input(9Enter the pass band ripple:9)/ 's.input(9Enter the stop band freAuenc(:9)/ fs.input(9Enter the sampling freAuenc(:9)/ beeta.input(9Enter the sampling Balue:9)/ 'c.('s='p)G#/ 'cr.('c7#7pi)Gfs/ d.(rs:F.?)G1%.$+/ b.'s:'p/ N.;fs7(dGb)=1>/ alp.(N:1)G#/ n.0:1 :( N:1)/ '.0:.01: pi/ eps.0.001/ 'D.Daiser (N8beeta)/ K o' pass filter hd.;sin('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'D9/ h<.freA<(hn818')/ subplot (#8#81)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label(9Magnitude in db9)/

title (9 o' pass filter9)/ KIigh pass filter hd.;sin(pi7(n:alp=eps)):sin('c7(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'D9/ h<.freA<(hn818')/ subplot (#8#8#)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9Iigh pass filter9)/ K!and pass filter 'c1..#)7pi/ 'c#..F)7pi/ hd.;sin('c#7(n:alp=eps)):sin('c17(n:alp=eps))>.G(pi7(n:alp=eps))/ hn.hd.7'D9/ h<.freA< (hn818')/ subplot (#8#8$)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9!and pass filter9)/ K!and stop filter hd.;sin('c17(n:alp=eps)):sin('c#7(n:alp=eps))=sin(pi7(n:alp=eps))>.G(pi7(n: alp=eps))/ hn.hd.7'D9/ h<.freA< (hn818')/ subplot (#8#8%)/ plot ('8#07log(abs(h<)))/ xlabel (95reAuenc( in radians9)/ (label (9Magnitude in db9)/ title (9!and stop filter9)/

Input: Enter the pass band ripple: # Enter the stop band ripple: )0 Enter the pass band ripple: 100 Enter the stop band freAuenc(: 1)0 Enter the sampling freAuenc(: %00 Enter the sampling Balue: 0% Output:

Result: Thus the 52H lo' pass8 high pass8 band pass and band stop filters 'ere designed b( 'indo'ing techniAues using MAT A! program.

Ex. No:+ Date:


Aim:

DESIGN OF IIR FILTER

To design 22H lo' pass8 high pass8 band pass and band stop filters (!utter'orth) using MAT A! program. Requirements: 1. -, #. MAT A! soft'are Algorithm: 1. &et the pass band and stop band ripples. #. &et the pass band and stop band edge freAuencies. $. &et the sampling freAuenc(. %. ,alculate the order of the filter ). 5ind the filter coefficients. +. -lot the magnitude and phase response.

a. Lo& pass !ilter: Program:


clc/ clear all/ close all/ rp.input (9Enter the pass band ripple:9)/ rs.input (9Enter the stop band ripple:9)/ fp.input (9Enter the pass band freAuenc(:9)/ fs.input (9Enter the stop band freAuenc(:9)/ f.input (9Enter the sampling freAuenc( :9)/ '1. (#7fp)Gf/ '#. (#7fs)Gf/ ;n8'c>.buttord ('18 '#8 rp8 rs89s9)/ ;b8a>.butter (n8'c89lo'989s9)/ '.0:.01: pi/ ;h8omega>.freAs (b8a8')/ m.#07log (abs(h))/ theta.angle(h)/ subplot (#8181)/ plot (omega8m)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9Magnitude response9)/ subplot (#818#)/ plot (omega8theta)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9-hase response9)/

Input: Enter the pass band ripple: .# Enter the stop band ripple: %0 Enter the pass band freAuenc(: 100 Enter the stop band freAuenc(: 1)0 Enter the sampling freAuenc(: %00 Output:

b. 'igh pass !ilter: Program: clc/ clear all/ close all/ rp.input (9Enter the pass band ripple:9)/ rs.input (9Enter the stop band ripple:9)/ fp.input (9Enter the pass band freAuenc(:9)/ fs.input (9Enter the stop band freAuenc(:9)/ f.input (9Enter the sampling freAuenc( :9)/ '1. (#7fp)Gf/ '#. (#7fs)Gf/ ;n8'c>.buttord ('18 '#8 rp8 rs89s9)/ ;b8a>.butter (n8'c89high989s9)/ '.0:.01: pi/ ;h8omega>.freAs (b8a8')/ m.#07log (abs(h))/ theta.angle(h)/ subplot (#8181)/ plot (omega8m)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9Magnitude response9)/ subplot (#818#)/ plot (omega8theta)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/

title (9-hase response9)/ Input: Enter the pass band ripple: .# Enter the stop band ripple: %0 Enter the pass band freAuenc(: 100 Enter the stop band freAuenc(: 1)0 Enter the sampling freAuenc(: %00 Output:

c. )and pass !ilter: Program: clc/ clear all/ close all/ rp.input (9Enter the pass band ripple:9)/ rs.input (9Enter the stop band ripple:9)/ fp.input (9Enter the pass band freAuenc(:9)/ fs.input (9Enter the stop band freAuenc(:9)/ f.input (9Enter the sampling freAuenc( :9)/ '1. (#7fp)Gf/ '#. (#7fs)Gf/ ;n>.buttord ('18 '#8 rp8 rs89s9)/ ;'c>.;'18'#>/ ;b8a>.butter (n8'c89bandpass989s9)/ '.0:.01: pi/ ;h8omega>.freAs (b8a8')/ m.#07log (abs(h))/ theta.angle(h)/ subplot (#8181)/ plot (omega8m)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9Magnitude response9)/ subplot (#818#)/ plot (omega8theta)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/

title (9-hase response9)/ Input: Enter the pass band ripple: .# Enter the stop band ripple: %0 Enter the pass band freAuenc(: 100 Enter the stop band freAuenc(: 1)0 Enter the sampling freAuenc(: %00 Output:

d. )and stop !ilter: Program: clc/ clear all/ close all/ rp.input (9Enter the pass band ripple:9)/ rs.input (9Enter the stop band ripple:9)/ fp.input (9Enter the pass band freAuenc(:9)/ fs.input (9Enter the stop band freAuenc(:9)/ f.input (9Enter the sampling freAuenc( :9)/ '1. (#7fp)Gf/ '#. (#7fs)Gf/ ;n>.buttord ('18 '#8 rp8 rs89s9)/ ;'c>.;'18'#>/ ;b8a>.butter (n8'c89stop989s9)/ '.0:.01:pi/ ;h8omega>.freAs(b8a8')/ m.#07log (abs(h))/ theta.angle(h)/ subplot (#8181)/ plot (omega8m)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9Magnitude response9)/ subplot (#818#)/ plot (omega8theta)/ xlabel (9Normali<ed freAuenc(9)/ (label (9&ain in db9)/ title (9-hase response9)/

Input: Enter the pass band ripple: .# Enter the stop band ripple: %0 Enter the pass band freAuenc(: 100 Enter the stop band freAuenc(: 1)0 Enter the sampling freAuenc(: %00 Output:

Result: Thus the 22H lo' pass8 high pass8 band pass and band stop filters (!utter'orth) 'ere designed using MAT A! program.

Ex. No:F Date:

STUD

OF TMS!"#C$# ARC%ITECTURE

Aim: To stud( the architecture TM*$#0,)0 fixed point processor Introduction: 2t is needless to sa( that in order t utili<e the feature of the D*- chip TM*$#0,)08 the D*- engineer must haBe a complete Dno'ledge of the D*- deBice. This chapter is an introduction to the hard'are aspects of the TM*$#0,)0. The important units of TM*$#0,)0 are discussed he %S* Chip +S,-.C/. The TM*$#0,)0 is a 1+:bit fixed point digital signal processor that combines the flexibilit( of a high speed controller 'ith the numerical capabilit( of an arra( processor8 thereb( offering an inexpensiBe alternatiBe to multichip bit:processors. The highl( paralleled architecture and efficient instruction set8 proBide speed and flexibilit( capable of executing 10 M2-* (Million 2nstructions -er *econd) The TM*$#0,)0 optimi<es speed b( implementing functions in hard'are that other processors implement through microcode or soft'are. This hard'are intensiBe approach proBides the design engineer 'ith processing po'er preBiousl( unaBailable on a single chip. The TM*$#0,)0 is the third generation digital signal processor in the TM*$#0 famil(. 2ts po'erful instruction set8 inherent flexibilit(8 high:speed number:crunching capabilities8 and innoBatiBe architecture haBe made this high:performance8 cost:effectiBe processor the ideal solution to man( telecommunication8 computer8 commercial8 industrial8 and militar( applications.

(e0 Features o! +S,-.C/. %&e 'ey (eature o( t&e "igital ignal proce or %)S*+,C-, are: $):G)0:ns single:c(cle fixed:point instruction execution time (#@.+G#0 M2-*) "p'ard source:code compatible 'ith all L,1M and L,#M deBices HAM:based memor( operation (L,)0) ?D x 1+:bit single:c(cle on:chip programGdata HAM (L,)0) #D x 1+:bit single:c(cle on:chip boot HEM (L,)0) 10)+x1+:bit dual:access on:chip data HAM ##%D x 1+:bit maximum addressable external memor( space (+%D program8 +%D data +%D 2GE and $#D global) $#:bit arithmetic logic unit (A ")8 $#:bit accumulator (A,,) and $#:bit accumulator buffer (A,,!) 1+:bit parallel logic unit (- ") 1+ x 1+:bit parallel multiplier 'ith a $#:bit product capabilit(. *ingle:c(cle multipl(Gaccumulate instructions EleBen auxiliar( registers 'ith a dedicated auxiliar( register arithmetic unit for indirect addressing. EleBen context:s'itch register (shado' registers) for storing strategic ,-":controlled registers during an interrupt serBice routine Eight:leBel hard'are stacD 0 to 1+:bit left right data barrel:shifters and a +%:bit incremental data shifter T'o indirectl( addressed circular buffers for circular addressing *ingle:instruction repeat and blocD repeat operations for program code !locD memor( moBe instructions for better program Gdata management 5ull:duplex s(nchronous serial port for direct communication bet'een the c)x and another serial deBice

Time:diBision multiple:access (TDM) serial port 2nterBal timer 'ith period8 control8 and counter registers for soft'are stop8 start and reset +%D parallel 2GE ports8 1+ of 'hich are memor( mapped *ixteen soft'are programmable 'ait:state generators for program8 data8 and 2GE memor( spaces.

Architecture A detailed architectural blocD diagram of TM*$#0,)0 is illustrated in figure. The TM*$#0,)0 utili<es a modified IarBard architecture for speed and flexibilit(. 2n a strict IarBard architecture8 program and data memor( are in t'o separate spaces8 permitting a full oBerlap of instruction fetch and execution. The TM*$#0 famil(Ns modification of the IarBard architecture allo's transfer bet'een program and data spaces8 thereb( increasing the flexibilit( of the deBice. This modification permits coefficients stored in program memor( to be read into the data HAM8 eliminating the need for a separate coefficient HEM. 2t also maDes aBailable immediate instructions and subroutines based on computed Balues. ,-1)it Accumulator The TM*$#0,)0 contains a $#:bit A " and accumulator for support of double:precision8 t'oNs complement arithmetic. The A " is a general purpose arithmetic unit that operates on 1+:bit 'ords taDen from the data HAM or deriBed from immediate instructions. 2n addition to the usual arithmetic instructions8 the A " can perform !oolean operations8 proBiding the bit manipulation abilit( reAuired of a high:speed controller. The accumulator stores the output from the A " and is often an input to the A ". 2ts 'ord length is $#:bit. The accumulator is diBided into a high:order 'ord (bits $1 through 1+) and a lo':order 'ord (bits 1) through 0). 2nstructions are proBided for storing and loading the high and lo'er order accumulator 'ords to memor(.

23 4 231)it *arallel +ultiplier The multiplier performs a 1+ x1+:bit t'oNs complement multiplication 'ith a $#:bit result in a single instruction c(cle. The multiplier consists of three units: the T:Hegister8 -:Hegister8 and multiplier arra(. The 1+:bit T:Hegister temporaril( stores the multiplicand and the -:Hegister stores the $#:bit product. Multiplier Balues either come from the data memor( or are deriBed immediatel( from the M-O (multipl( immediate) instruction 'ord. The fast on:chip multiplier allo's the deBice to perform fundamental operations such as conBolution8 correlation8 and filtering. T'o

multipl(Gaccumulate instructions in the instruction set full( utili<e the computational band'idth of the multiplier8 allo'ing both operands to be processed simultaneousl(.

Shi!ters A 1+:bit scaling shifter is aBailable at the accumulator input. This shifter produces a left shift of 0to1+:bits on the input data to accumulator.TM*$#0,)0 also contains a shifter at the accumulator output. This shifter proBide a left shift of 0to F8 on the data from either the A,,I or A,, register. 2n addition one shifter at the output of -:register can shift the product b( 1 or %:bits left or +:bits right8 before transferring the product to accumulator. %ata And *rogram +emor0 *ince the TM*$#0,)0 uses IarBard architecture8 data and program memor( reside in t'o separate spaces. Additionall( TM*$#0,)0 has one more memor( space called 2GE memor( space. The total memor( capacit( of TM*$#0,)0 is +%JP each of -rogram. Data and 2GE memor(. The +%JP of data memor( is diBided into )1# pages 'ith each page containing 1#@ 'ords. Enl( one page can be actiBe at a time. Ene data access on chip data HAM and ?J 'ords of single access DataG-rogram HAM. The 10)+ 'ords of on chip data memor( is diBided as three blocDs !08!1 Q !#8 of 'hich !0 can be configured as program or data HAM. Eut of the +%JP of total program memor(8 TM*$#0,)0 has #J 'ords of on:chip program HEM. The TM*$#0,)0 offers t'o modes of operation defined b( the state of the M,GMpin: the microcomputer mode (M,GM-.1) or the microprocessor mode (M,GM-.0). 2n the microcomputer mode8 on:chip HEM is mapped into the memor( space 'ith up to #J 'ords of memor( aBailable. 2n the microprocessor mode all +%J 'ords of program memor( are external.

Interrupts and Su5routines The TM*$#0,)0 has three external masD able user interrupts aBailable for external deBices that interrupt the processor. The TM*$#0,)0 contains an eight:leBel hard'are stacD for saBing the contents of the program counter during interrupts and subroutine calls. 2nstructions are aBailable for saBing the deBiceNs complete context. -"*I and -E- instructions permit a leBel of nesting restricted onl( b( the amount of aBailable HAM. Serial *ort A full:duplex on:chip serial port proBides direct communication 'ith serial deBices such as codes8 serial AGD conBerters and other serial s(stems. The interface signals are compatible 'ith codes and man( others serial deBices 'ith a minimum of external hard'are. Input and 6utput The 1+:bit parallel data bus can be utili<ed to perform 2GE functions in t'o c(cles. The 2GE ports are addressed b( the four *!s on the address lines8 allo'ing 1+ input and 1+ output ports. 2n addition8 a polling input for bit test and Rump operations (!2E) and three interrupt pins (2NT0:2NT#) haBe been incorporated for multitasDing.

Ex. No:@ Date:


Result: Thus the Architecture of TM*$#0,)0 D*- processor 'as studied.

STUD

OF TMS!"#C$&'( ARC%ITECTURE

Aim: To stud( the architecture TM*$#0,)%1+ fixed point processor. ARC'I EC URE: The S,)%1+ D*- implements the standard L,)%M ,-" 'hich uses an adBanced8 modified IarBard architecture that maximi<es processing po'er maintaining three separate bus structures for data memor( and one for program memor( . *eparate program and data spaces allo' simultaneous access to program instructions and data8 proBiding a high degree of parallelism. 5or example8 t'o read operation and one 'rite operation can be performed in a single c(cle. 2nstructions 'ith parallel store and application Tspecific instructions full( utili<e this architecture/ in addition8 data can be transferred bet'een data and program spaces. *uch parallelism supports a po'erful set of arithmetic8 logic8 and bit:manipulation operations that can all be performed in a single machine c(cle. 2n addition the S,)%1+ includes the control mechanisms to manage interrupts8 repeated operations8 and function calls. +emor0

The S,)%1+ deBice proBides both on:chip HEM and HAM memories to aid in s(stem performance and integration. 6n1chip R6+ &ith 5oot loader The S,)%1+ features a 1+D:'ord x 1+:bit on:chip masD able HEM that can onl( be mapped into program memor( space. ,ustomers can arrange to haBe the HEM of the )%1+ programmed 'ith contents uniAue to an( particular application. A boot loader is aBailable in the standard LS,)%1 0 on:chip HEM. This boot loader can be used to automaticall( transfer user code from an external source to an( 'here in the program memor( at po'er up. 2f M-5M:,: of the deBice is sampled lo' during a hard'are reset8 execution begins at location 55@0h of the on:chip HEM. This location contains a branch instruction to the start of the boot loader program. The standard LS,)%1 0 deBices proBide different 'a(s to do'nload the code to accommodate Barious s(stem reAuirements. -arallel from @:bit or 1+:bit 'ide E-HEM -arallel from 2GE space8 @:bit or 1+:bit mode *erial boot from serial ports8 @:bit or 1+:bit mode Iost:port interface boot Parm boot %&e tan"ar" on.c&ip !O) layout i 0DD!ESS !01GE ,000h:D%55h D)00h:D+55h DF00h:D,55h DD00h:DE55h D500h:5F55h 5@00h:5!55h 5,00h:5,55h 5D00h:5D55h 5E00h:5E55h 5500h:55F5h 55@0h:5555h 6n1Chip Ram &own below table/

DESC!IP%IO1 HEM tables for the &*M E5H speech codec #)+ point complex radix:# D25 55T 'ith looped code 55T t'iddle factors for a #)+ point complex radix:# 55T 10#% point complex radix:# D2T55T 'ith looped code 55T t'iddle factors for a 10#% point complex radix:# 55T !oot loader U :la' expansion table A:la' expansion table *ine looD up table HeserBed = 2nterrupt Bector table

The LS,)%10 deBice contains @D 'ords x 1+:bit on:chip dual:access HAM(DAHAM) and )+J 'ords x 1+:bit of on:chip single:access HAM(*AHAM).The DAHAM is composed of four blocDs of #D 'ords each. Each blocD in the DAHAM can support t'o reads in one c(cle8 or a read and a 'rite in one c(cle. The DAHAM is located in the address range 00@0h:1 555I in data space8 and can be mapped into programGdata space b( setting the ES O bit to one. The *AHAM is composed of seBen blocDs of @J 'ords each. Each of these seBen blocDs is a single:access memor(. 5or example8 an instruction 'ord can be fetched from one *AHAM blocD in the same c(cle as a data 'ord is 'ritten to another *AHAM blocD. The *AHAM located in the address range #000h:F555h in data space can be mapped into program space b( setting the ES O bit to one8 'hile the *AHAM located in the address range 1@000h:1 5555I in program space can be mapped into data space b( setting the DHEM bit to one.

6n chip +emor0 Securit0

The LS,)%1+ deBice has a maDeable option to protect the contents of on:chip memories. Phen the HEM protect bit is set8 no externall( originating instruction can access the on:chip memor( spaces. 2n addition8 'hen the HEM protect option is enabled8 I-1@ read access is limited to address range 0001 000h:0001 555I. Data located outside this range cannot be read through the I-1@. Prite access to the entire I-1@ memor( map is still maintained. *rogram +emor0 *oft'are can configure their memor( cells to reside inside or outside of the program address map. Phen the cells are mapped into program space8 the deBice automaticall( accesses them 'hen their address 'ith in bounds. Phen the program:address generation (-A&EN) logic generates an address outside its bounds8 the deBice automaticall( generates an external access. %&e a"vantage o( operating (rom on.c&ip memory are a (ollow / Iigher performance because no 'ait states are reAuired o'er cost than external memor( o'er po'er than external memor( The adBantage of operating from off:chip memor( is the abilit( to access a larger address space8 re:locatable interrupt Bector table The reset8 interrupt8 and trap Bectors are addressed in program space. These Bectors are soft T meaning that the processor8 'hen taDing the trap8 loads the program counter (-,) 'ith the trap address and executes the code at the Bector location to accommodate a dela(ed branch 2nstruction 'hich allo's branching to the appropriate interrupt serBice routine 'ithout the oBerhead. At deBice reset8 the reset8 interrupt8 and trap Bectors are mapped to address 55@0h in program space. Io'eBer8 these Bectors can be remapped to the beginning of an( 1#@:'ord page in program space after deBice reset. This is done b( loading the interrupt Bector pointer (2-TH) bits in the -M*T register 'ith the appropriate 1#@:'ord page boundar( address. After loading 2-TH8 an( user interrupt or trap Bector is mapped to the ne' 1#@:'ord page. %ata +emor0 The data memor( space address up to +%J of 1+:bit 'ords. The deBice automaticall( accesses the on:chip HAM 'hen addressing 'ithin its bounds. Phen an address is generated outside the HAM bounds8 the deBice automaticall( generates an external access. %&e a"vantage o( operating (rom on.c&ip memory are a (ollow : Iigher performance because no 'ait states are reAuired

Iigher performance because of better flo' 'ithin the pipeline of the central arithmetic logic unit(,A ") o'er cost than external memor( o'er po'er than external memor(

6n1Chip *eripherals %&e 23C-45 , "evice &ave t&e (ollowing perip&eral : *oft'are:programmable 'ait:state generator -rogrammable banD:s'itching A host:port interface (I-1@) Three multi:channel buffered serial pots(M,!*-s) A hard'are timer A clocD generator 'ith a multiple phase:locDed loop( Enhanced external parallel interface(M10#) A DMA controller (DMA) So!t&are1*rogramma5le #ait1State 7enerator The soft'are:programmable 'ait:state generator can extend external bus c(cles b( up to fourteen , JE"T c(cles8 proBiding a conBenient means of interfacing the LS,)%1 0 'ith slo'er external deBices. DeBices that reAuire more than fourteen 'ait states can be interfaced using the hard'are HEADO line. Phen all external accesses are configured for <ero 'ait states8 the internal clocDs to the 'ait:state generator are shut off/ shutting off these paths from the internal clocDs allo's the deBice to run 'ith lo'er po'er consumption. The soft'are:programmable 'ait:state generator is controlled b( the 1+:bit soft'are 'ait:state register (*PP*H)8 'hich is memor(:mapped to address 00#@h in data space. The program and data spaces each consist of t'o $#D:'ord blocDs/ the 2GE space consists of one +%J:'ord blocD. Each of these blocDs has a corresponding $:bit field in the *PP*H. The Balue of a $:bit field in *PP*H8 in conRunction 'ith the soft'are 'ait:state multiplier (*P*M) bit in the soft'are 'ait:state control register (*P,H)8 specifies the number of 'ait states to be inserted for each access in the corresponding space and address range. Phen *P*M . 08 the possible Balues for the number of 'ait states are 08 18 #8 $8 %8 )8 +8 and F. This is the default configuration. )

Phen *P*M .18 the possible Balues for the number of 'ait states are 08 #8 %8 +8 @8 108 1#8 and 1%. At reset8 the *PP*H is set to F555h and *P*M to 08 configuring seBen 'ait states for all external accesses.

Result: Thus the stud( of TM*$#0,)%1+ -rocessor 'as studied.

Ex. No:? Date:

ARIT%METIC OPERATION

Aim: To perform 1+ bit addition and multiplication in Barious addressing modes using TM*$#0,)%1+ -rocessor. Requirements: 1. -, #. Debugger soft'are

Algorithm: 1. 2nitiali<e the data pointer b( 1%0h.8 'hich denotes the data memor( A000h. #. &et the t'o 1+ bit data in the memor( location A000h8 A001h. $. -erform the additionGmultiplication. %. *tore the result in the memor( location A00#h. ). Ialt the program.

*rocedure: 1. Turn on the D*- processor Dit #. Epen the debugger soft'are. $. 2n the menu go to Bie' then clicD 'orDspace. %. &o to proRect and open a ne' proRect and create the proRect file 4. &o to file:ne':assembl( file +. T(pe the assembl( leBel program and saBe the file. 5. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect

6. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file ?. &o to proRect the clicD build 'hich creates the A*,22 file 10. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 11. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1#. a) &o to serial then clicD communication 'indo'. 2n the communication 'indo' t(pe *D (*ubstitute Data memor() then space the data memor( address. &iBe the input data in the memor( location. b) -ress dot De( in the De(board to come out from the data memor(. c) T(pe &E then space enter the starting address of the program memor( (,000).-ress enter 'hich executes the do'nloaded A*,22 file in the D*- processor. ") -ress the reset button in the D*- Dit and see the output b( t(ping the *D then the memor( location of the output. space

a. %IREC A%%RESSI87 9 A%%I I68

Program:
2N-1 2N-# E"T .MMHE&*
.TEMT

.*ET 0I .*ET 1I .*ET #I

*TAHT: D V1%0I8 D-

H*!M ,NENENENED ADD *T I T: ! 2N-18 A 2N-#8 A A8 E"T I T

Input: Data Memor(: A000h A001h Output: Data Memor(: A00#h 000@h 000%h 000%h

b. %IREC A%%RESSI871+UL I*LICA I68

Program:
.MMHE&* .TEMT *TAHT: *TM V01%0I8 *TE H*!M ,H*!M 5H,T NENE-

NENED D M-O *T *TI I V000I8 A 00h8 T 01I8 A A8 0#I A8 0$I ! I

Input MEM A000I A001I Output MEM A000I A001I DATA )A?0I 01%!I DATA 1#$%I 1#$%I

c. I8%IREC A%%RESSI87 1A%%I I68

Program: *TAHT D V00I8 A *TM V1000I8 AH% *TM V#000I8 AH) *TM V$00I8 AH+ D 7AH%8 A ADD 7AH)8 A

*T I !

A87AH+= I

Input: Memor( 100h #00h Output: Memor( $000h Data ,+$A Data A#5Fh #$%$h

d. AU4ILLAR: RE7IS ER A%%RESSI87 9 A%%I I68 Program: .MMHE&* .TEMT *TAHT: D V00I8 A *TM *TM DM V1000I8 AH% V$00I8 AH+ AH%8 A

ADD *T I Output: Memor( $000I Data !

V##I8 A A87AH+ I

10##I

Result: Thus the 1+ bit addition and multiplication 'ere performed in Barious addressing modes using TM*$#0,)%1+ -rocessor.

Ex. No:10 Date:

SAMPLING OF INPUT SIGNAL AND DISPLA


Aim: To perform sampling on input signal using TM*$#0,)%1+ -rocessor. Requirements: 1. -, #. Debugger soft'are

$. ,HE *rocedure: 1. Turn on the D*- processor Dit #. Epen the debugger soft'are. $. 2n the menu go to Bie' then clicD 'orDspace. %. &o to proRect and open a ne' proRect and create the proRect file 4. &o to file:ne':assembl( file +. T(pe the assembl( leBel program and saBe the file. 5. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect 6. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file ?. &o to proRect the clicD build 'hich creates the A*,22 file 10. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 11. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1#. a) &o to serial then clicD communication 'indo'. 2n the communication 'indo' t(pe *D (*ubstitute Data memor() then space the data memor( address. &iBe the input data in the memor( location. b) -ress dot De( in the De(board to come out from the data memor(. c) T(pe &E then space enter the starting address of the program memor( (0000).-ress enter 'hich executes the do'nloaded A*,22 file in the D*- processor. ") -ress the reset button in the D*- Dit and see the output on ,HE. Program: TMD *T* DATA DE AO !$ !# .*ET .*ET .*ET .*ET .*ET .*ET 0I 1I #I $I 05000I 0500I

!1 !0 .text *TAHT: DAH AH HE-: 2N H-T NE2N *- J H-T NEA,, AND

.*ET .*ET .mmregs

0050I 0005I

V100I AH08 V?000I AH18 V$)? 08 0+ V05I 08 0% V)55I8 DE AO DE AO

0 V0555I

*"! VF55I MAH *A, A,, *A, ,A HE-*EH: AH AH HE-*AM-: MAH A,, 78 AH# 7= AH#8 V?000I AH08 VF1? 78 AH0 7=8 08 AH1 DE AO DATA *EH2A

!ANW HE-87:

*A, ,A MAH

DATA *EH2A 78 AH0

!ANW HE-*AM-87: AH AH HE-1: 2N AH08 V?000I AH18 V$)? 08 0+ V05I

H-T NE2N *- J H-T NEA,, AND

08 0% V)55I8 DE AO DE AO

0 V0555I

*"! VF55I MAH *A, 78 AH0 7=8 08 AH1

!ANW HE-187:

A,, *A, ,A AH AH

DE AO DATA *EH2A AH#8 V?000I AH08 VF1?

HE-*AM-1: MAH A,, *A, ,A MAH 78 AH# 7= DATA *EH2A 78 AH0

!ANW HE-*AM-187:

HE-*EH1 ! *EH2A *- J ,A H-T NEV#)I8 TMD TMDATA V0555I HE-*EH1

A,, AND !*AH *A, ,A ,A H-T NEA,, AND !*AH *A, ,A ,A H-T NEA,, AND !*AH *A, ,A ,A H-T NEA,, AND *A, ,A ,A H-T

DATA V!$ 1# TMD IEMA*, TMDATA V0555I

DATA V!# @ TMD IEMA*, TMDATA V0555I

DATA V!1 % TMD IEMA*, TMDATA V0555I

DATA V!0 TMD IEMA*, TMDATA V0555I

NE*- J ,A H-T NEHET IEMA*,: A,, *"! !,ND A,, ADD *A, HET &HT?: *A, HET TMDATA: HE-,IJ: 2N AND !,ND E"T HET *T*8 ? *T* V0%I HE-,IJ8 EX TMD8 @ A,, A,, TMD ADD V$FI TMD TMD V?I &HT?8 &T TMD V$0I TMD V#%I8 TMD TMDATA V0555I

Ex. No:11 Date:

Result: Thus the sampling 'as performed on input signal using TM*$#0,)%1+ -rocessor.

IMPLEMENTATION OF FIR FILTER

Aim: To implement 52H lo' pass and band pass filter using TM*$#0,)%1+ -rocessor. Requirements: 1. -,

#. Debugger soft'are $. ,HE *rocedure: 1. Turn on the D*- processor Dit #. Epen the debugger soft'are. $. 2n the menu go to Bie' then clicD 'orDspace. %. &o to proRect and open a ne' proRect and create the proRect file 4. &o to file:ne':assembl( file +. T(pe the assembl( leBel program and saBe the file. 5. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect 6. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file ?. &o to proRect the clicD build 'hich creates the A*,22 file 10. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 11. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1#. a) &o to serial then clicD communication 'indo'. 2n the communication 'indo' t(pe *D (*ubstitute Data memor() then space the data memor( address. &iBe the input data in the memor( location. b) -ress dot De( in the De(board to come out from the data memor(. c) T(pe &E then space enter the starting address of the program memor( (0000).-ress enter 'hich executes the do'nloaded A*,22 file in the D*- processor. ") -ress the reset button in the D*- Dit and see the output on ,HE. a. Lo& pass Filter Program: !$ !# !1 .*ET .*ET .*ET 05000I 0500I 0050I

!0 DATA TMD

.*ET .*ET .*ET .mmregs .text

0005I )0I )1I

*TAHT: *TM H*!M H*!M NENE*TM D H-T *T HE-52H : *TM *TM EE-: -EHTH 0+8 0 ,IJY!"*O: -EHTH 0F8 0 !2T5 !, D AND MEH *"! *TM *T *TM 08 V#0I ,IJY!"*O8 T, 08 A V0555I8 A V0@00I8 A V@00I8 A V1)0I8 AH1 A87AH1 V1@$I8 AH# V0A#00I8 AH% V$)?8 AH) V1)0I8 AH1 V0I8 A V$%I A87AH1= V01h8 *T0 ,5H,T

-EHTH 0%8 0

D H-T

V0I8 A V$$I 7AH#:8 TA! E8 A A8 180I 0I8 A V@00I8 A A8 1I A87AH%= EE-87AH): V0A#00I8 AH# V$)?8 AH$ V1%0I8 *T0 ,-

MA,D *TI D ADD / / *T *T !ANW *TM *TM HE-*EH: *TM H*!M NENENENED *T ,A *TM H*!M H*!M NENE! *EH2A : *TM H*!M

-EHTP 1I8 0%I

7AH#=8 A A8 DATA *EH2A V01h8 *T0 ,5H,T

*"! VF55I8A

!ANW HE-*EH87AH$:

HE-52H V1%0I8 *T0 ,-

NENENENED ,A *TM H*!M NENENENED AND *5T ,A ,A *TM H*!M NENENENED AND *5T ,A ,A *TM H*!M NENENENEDATA8 A V!#8 A A8:@ IEMA*, TMDATA V1%0I8 *T0 ,/1st digit (from msb) DATA8 A V!$8 A A8:1# IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb) V#)I8 A TMDATA V1%0I8 *T0 ,-

D AND *5T ,A ,A *TM H*!M NENENENED AND ,A ,A *TM H*!M NENENENED ,A *TM H*!M NENENENEHET IEMA*,: ADD D

DATA8 A V!18 A A8:% IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb)

DATA8 A V!08 A IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb)

V#%I8 A TMDATA V1%0I8 *T0 ,-

V$0I8 A A8 !

*"! !, ADD E**?: HET TMDATA: ,A **!M rpt nop HET

V$AI8 ! E**?8 ! T VFI8 A

@,+?I 2NTM /dela( V#ffh

/ @,$@I for )%1+ mode 1

/fs . %1Dh< / fc . %Dh< / N . )# TA! E: .'ord 015I .'ord 010EI .'ord 01A!I .'ord 01!%I .'ord 011FI .'ord 0I .'ord 05E,DI .'ord 05DEEI .'ord 05D,#I .'ord 05E+EI .'ord 055,DI .'ord 01+5I .'ord 0#,0I .'ord 0$$$I .'ord 0#F%I .'ord 0?FI .'ord 05E1?I .'ord 05!,!I .'ord 05A?!I .'ord 05!)$I

.'ord 05E)0I .'ord 0$+#I .'ord 0?,)I .'ord 010%@I .'ord 01)??I .'ord 01@?)I .'ord 01@?)I .'ord 01)??I .'ord 010%@I .'ord 0?,)I .'ord 0$+#I .'ord 05E)0I .'ord 05!)$I .'ord 05A?!I .'ord 05!,!I .'ord 05E1?I .'ord 0?FI .'ord 0#F%I .'ord 0$$$I

.'ord 0#,0I .'ord 01+5I .'ord 055,DI .'ord 05E+EI .'ord 05D,#I .'ord 05DEEI .'ord 05E,DI .'ord 0I .'ord 011FI .'ord 01!%I .'ord 01A!I .'ord 010EI .'ord 015I

b. )and *ass Filter Program: !$ !# !1 !0 DATA TMD .*ET .*ET .*ET .*ET .*ET .*ET .mmregs .text *TAHT: *TM H*!M H*!M NENE*TM D H-T *T HE-52H : *TM *TM EE-: -EHTH 0+8 0 ,IJY!"*O: -EHTH 0F8 0 !2T5 !, 08 V#0I ,IJY!"*O8 T, V0A#00I8 AH% V$)?8 AH) V1)0I8 AH1 V0I8 A V$%I A87AH1= V01h8 *T0 ,5H,T 05000I 0500I 0050I 0005I )0I )1I

-EHTH 0%8 0 D AND MEH *"! *TM *T *TM D H-T MA,D *TI D ADD / / *T *T !ANW *TM *TM HE-*EH: *TM H*!M NENENENED 7AH#=8 A V1%0I8 *T0 ,08 A V0555I8 A V0@00I8 A V@00I8 A V1)0I8 AH1 A87AH1 V1@$I8 AH# V0I8 A V$$I 7AH#:8 TA! E8 A A8 180I 0I8 A V@00I8 A A8 1I A87AH%= EE-87AH): V0A#00I8 AH# V$)?8 AH$

-EHTP 1I8 0%I

*"! V0F55I8 A *T ,A A8 DATA *EH2A

!ANW HE-*EH87AH$:

*TM H*!M H*!M NENE! *EH2A : *TM H*!M NENENENED ,A *TM H*!M NENENENED AND *5T ,A ,A *TM H*!M NENE-

V01h8 *T0 ,5H,T

HE-52H

V1%0I8 *T0 ,-

V#)I8 A TMDATA V1%0I8 *T0 ,-

DATA8 A V!$8 A A8:1# IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb)

NENED AND *5T ,A ,A *TM H*!M NENENENED AND *5T ,A ,A *TM H*!M NENENENED AND ,A ,A *TM H*!M NEDATA8 A V!08 A IEMA*, TMDATA V1%0I8 *T0 ,/1st digit (from msb) DATA8 A V!18 A A8:% IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb) DATA8 A V!#8 A A8:@ IEMA*, TMDATA V1%0I8 *T0 ,/ 1st digit (from msb)

NENENED ,A *TM H*!M NENENENEHET IEMA*,: ADD D *"! !, ADD E**?: HET TMDATA: ,A **!M rpt nop HET /fs . %1Dh< / fc . %Dh< / N . )# TA! E: .'ord #0@I .'ord #)FI .'ord #1@I @,+?I 2NTM /dela( V#ffh / @,$@I for )%1+ mode 1 V$0I8 A A8 ! V$AI8 ! E**?8 ! T VFI8 A V#%I8 A TMDATA V1%0I8 *T0 ,-

.'ord 1%$I .'ord 0I .'ord 05E?EI .'ord 05DFAI .'ord 05,EFI .'ord 05D0@I .'ord 05DD1I .'ord 05EE,I .'ord 055E%I .'ord $DI .'ord 055A1I .'ord 05D5,I .'ord 05!@5I .'ord 05@E,I .'ord 05+D%I .'ord 05+0@I .'ord 05F1$I .'ord 05A#1I .'ord 05EE+I .'ord %AFI .'ord 0A+0I .'ord 0E5@I .'ord 11@FI .'ord 11@FI .'ord 0E5@I .'ord 0A+0I .'ord %AFI .'ord 05EE+I .'ord 05A#1I .'ord 05F1$I .'ord 05+0@I .'ord 05+D%I .'ord 05@E,I .'ord 05!@5I

.'ord 05D5,I .'ord 055A1I .'ord $DI .'ord 055E%I .'ord 05EE,I .'ord 05DD1I .'ord 05D0@I .'ord 05,EFI .'ord 05DFAI .'ord 05E?EI .'ord 0I .'ord 1%$I .'ord #1@I .'ord #)FI .'ord #0@I

Ex. No:1# Date:

Result: Thus the 52H lo' pass and band pass filters 'ere implemented using TM*$#0,)%1+.

CALCULATION OF FFT

Aim: To find 5ast 5ourier Transform for giBen input seAuence using TM*$#0,)%1+ -rocessor. Apparatus Required: 1. -, #. Debugger soft'are Algorithm: 1. 2nitiali<e the data pointer b( 1%0h.8 'hich denotes the data memor( A000h. #. &et the t'o 1+ bit data in the memor( location A000h8 A001h. $. -erform the additionGmultiplication. %. *tore the result in the memor( location A00#h. ). Ialt the program.

*rocedure:

1. Turn on the D*- processor Dit #. Epen the debugger soft'are. $. 2n the menu go to Bie' then clicD 'orDspace. %. &o to proRect and open a ne' proRect and create the proRect file 4. &o to file:ne':assembl( file +. T(pe the assembl( leBel program and saBe the file. 5. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect 6. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file ?. &o to proRect the clicD build 'hich creates the A*,22 file 10. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 11. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1#. a) &o to serial then clicD communication 'indo'. 2n the communication 'indo' t(pe *D (*ubstitute Data memor() then space the data memor( address. &iBe the input data in the memor( location. b) -ress dot De( in the De(board to come out from the data memor(. c) T(pe &E then space enter the starting address of the program memor( (,000).-ress enter 'hich executes the do'nloaded A*,22 file in the D*- processor. ") -ress the reset button in the D*- Dit and see the output b( t(ping the *D then space the memor( location of the output.

Program:

J DN* TP2D, TP2D* 2N, !5O !5O, DN*, &H&H-, *T& *T&, 2N,T5 AH11 AH1# AH1$ AH1% !$ !# !1 !0 DATA TMD M" 5 ADD*"!5 !2THES5

.*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .*ET .mmregs .text

@I #I 0A)00I 0A))0I 0A%00I 0I 1I $I %I )I +I FI ?I 11I 1#I 1$I 1%I 05000I 0500I 0050I 0005I $0I $1I 0?+)0I 0?+@0I 0?F00I 0?F10I 0?@?0I

2N, "DE5 HE-*

*TAHT:

*TM H*!M *TM H*!M NENENENE,A ,A *T *T *T *T D *"! *T

V%0I8 -M*T ,V1%0I8 *T0 5H,T

!2THES5 2N, "DE5 V1I8 !5O V%I8 &HV#I8 DN* V$I8 *T& *T&8 A V1I8 A A8 *T&,

*TM H-T MS-D

VTP2D,8 AH0 V$I TA!,E*87AH0=

*TM H-T MS-D *TM *T& E-:

VTP2D*8 AH0 V$I TA!*2N87AH0= V#I8 AH) /AH) . *TA&E EE-

*T D *"! *T D *"! *T D *T M *"! *T D D

V0I8 J !5O8 A V1I8 A A8 !5O, &H-8 A V1I8 A A8 &H-, DN*8 A A8 AH0 V1I8 A A8 DN*, DN*,8 A &H-8 A &H-8 V%I / NG#.@G#.%I

,M-M !, D NEY,I&: *T D *T M

NEY,I&8 NT, V0I8 A

A8 2N,T5 &H-,8 A A8 AH$ / AH$ . &HE"- EE-

*TM &H- E-: *T D *T M !5O E-: D ,A D *T M D ,A D ADD *T

V2N,8 AH1

V0I8 J !5O,8 A A8 AH%

/D is initiall( 0 in all groups

/ AH% . !5 O EE-

7AH1=08 A M" 5 DN*8 A A8 AH0 7AH1:08 A ADD*"!5 J8 A 2N,T58 A A8 J

!ANW !5O E-87AH%: D *T M D DN*8 A A8 AH0 7AH1=08 A

!ANW &H- E-87AH$: M-O *T M-O *T *T M D *T !5O8 V#8 A A8 !5O DN*8 V#8 A A8 DN* A8 AH0 &H-8 A A8:18 &H/ &H- G # . &H/ DN* 7 # . DN* / !5O 7 # . !5O

!ANW *T& E-87AH): ,A hlt: HE-* ! hlt

TA!,E*: .'ord .'ord .'ord .'ord TA!*2N: 00100I 000!)I 00000I 055%!I

.'ord .'ord .'ord .'ord

00000I 055%!I 05500I 055%!I

Input: D0%0 )E)O!6

Output: D0%0 )E)O!6

0A#00 0A#01 0A#0# 0A#0$ 0A#0% 0A#0) 0A#0+ 0A#0F

0F00 0!00 0500 0!00 0F00 0$00 0000 0$00

0A%00 0A%01 0A%0# 0A%0$ 0A%0% 0A%0) 0A%0+ 0A%0F 0A%0@ 0A%0? / / / / / / 0A%0A 0A%0! 0A%0, 0A%0D 0A%0E 0A%05

$?00 0000 0000 E)!0 5500 0000 0000 0$!0 0100 0000 0000 5,)0 5500 0000 0000 1A)0

Ex. No:1$ Date:

Result: Thus the 5ast 5ourier Transform of giBen input seAuence 'as found using TM*$#0,)%1+ processor

)AVEFORM GENERATION
Aim: To generate sAuare 'aBe and sa'tooth 'aBe using TM*$#0,)%1+ -rocessor. Requirements: 1. -, #. Debugger soft'are $. ,HE Algorithm: 1. 2nitiali<e the data pointer b( 100h.8 'hich denotes the data memor( @000h. #. *et the maximum amplitude of the 'aBeform. $. *et the freAuenc( of the 'aBeform. %. *et the output port address(DA,) ). ,omplement the maximum amplitude to get the minimum amplitude of the 'aBeform. +. Hepeat the maximum amplitude and minimum amplitude to get the sAuare 'aBeform. F. Ialt the program.

*rocedure: 1. Turn on the D*- processor Dit #. ,onnect the ,HE in the DA, output pin. $. Epen the debugger soft'are. %. 2n the menu go to Bie' then clicD 'orDspace. ). &o to proRect and open a ne' proRect and create the proRect file +. &o to file:ne':assembl( file F. T(pe the assembl( leBel program and saBe the file. @. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect ?. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file 10. &o to proRect the clicD build 'hich creates the A*,22 file 11. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 1#. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1$. Execute the program and the output in the ,HE.

a. Square #ave

Program:
*TAHT: *TM H*!M NENENENEHE-: *T ,A *T ,A ! DE AO: *TM DE 1: -EHTP DATA8 0%I !ANW HET DE 187AH1: V0555I8 AH1 V0I8 DATA DE AO V0555I8 DATA DE AO HEV1%0I8 *T0 ,-

a. Sa&tooth #ave

Program: .MMHE&*
.TEMT *TAHT: *TM V1%0I8 *T0 ,H*!M NENENENE-

HE-: *T 2N,: D ADD *T / DATA8 A V1I8 A A8 DATA V0I8 DATA

-EHTP DATA8 0%I ,M-M DATA8 V0555I ! HE!, 2N,8 NT,

Result: Thus the sAuare 'aBe and sa'tooth 'aBeforms 'ere generated using TM*$#0,)%1+ -rocessor.

Ex. No:1% Date:

TABLE DATA TRANSFER

Aim: To 'rite and execute a program for accessing table using TM*$#0,)%1+ -rocessor. Requirements: 1. -, #. Debugger soft'are Algorithm: 1. 2nitiali<e the data pointer b( 1%0h.8 'hich denotes the data memor( A000h. #. *et the maximum amplitude of the 'aBeform. $. *et the freAuenc( of the 'aBeform. %. *et the output port address(DA,) ). ,omplement the 'aBeform +. Hepeat the maximum amplitude and minimum amplitude to get the sAuare 'aBeform. F. Ialt the program. maximum amplitude to get the minimum amplitude of the

*rocedure: 1. Turn on the D*- processor Dit #. ,onnect the ,HE in the DA, output pin. $. Epen the debugger soft'are. %. 2n the menu go to Bie' then clicD 'orDspace. ). &o to proRect and open a ne' proRect and create the proRect file +. &o to file:ne':assembl( file F. T(pe the assembl( leBel program and saBe the file. @. &o to proRect:add file to proRect 'hich linDs the assembl( file 'ith the proRect ?. ,licD cmd file: add file to proRect 'hich creates the cmd file associated 'ith assembl( file and proRect file 10. &o to proRect the clicD build 'hich creates the A*,22 file 11. &o to serial in the menu and clicD port settings 'hich giBe the connection bet'een s(stem and the Dit. 1#. &o to serial then clicD load program 'hich do'nloads the A*,22 file from s(stem to the Dit. 1$. Execute the program and the output in the ,HE.

Program: .MMHE&* .TEMT *TAHT D V1%0I H*!M ,NENENENE*TM V0A100I8 AH1 *T VTA! E8 00I D 00I8 A H-T V0%I HEADA 7AH1= I !I TA! E: .PEHD .PEHD .PEHD .PEHD .PEHD 001#$I 0%)+FI 0@?A!I 0,DE5I 001#$I

Output: A100 A101 A10# A10$ A10% 001#$I 0%)+FI 0@?A!I 0,DE5I 001#$I

RESUL : Thus the program for accessing table 'as 'ritten and executed #sing 78S9,*C4:1; <rocessor.

+A LA) Commands: Conv : , . ,ENS (A8 !) conBolBes Bectors A and !. The resulting Bector is length EN&TI (A) = EN&TI (!):1. Lengt& : EN&TI(M) returns the length of Bector M. Bector. 7re89 : Digital filter freAuenc( response. ;I8 P> . 5HEXW (!8 A8 N) returns the N:point complex freAuenc( response Bector I and the N:point freAuenc( Bector P in radiansGsample of the filter: 0b : Absolute Balue. A!*(M) is the absolute Balue of the elements of M. Phen M is complex8 A!*(M) is the complex modulus (magnitude) of the elements of M. $ai er : P . JA2*EH (N8 beta) returns an N:point Jaiser 'indo' in the column Bector P for the giBen beta Balue. :uttor" : !utter'orth filter order selection. ;N8 Pn> . !"TTEHD (Pp8 Ps8 Hp8 Hs) returns the order N of the lo'est order digital !utter'orth filter that loses no more than Hp d! in the pass band and has at least Hs d! of attenuation in the stopband. Pp and Ps are the passband and stopband edge freAuencies8 normali<ed from 0 to 1 ('here 1 corresponds to pi radiansGsample). 5or example8 o'pass: Pp . .18 Iighpass: Pp . .#8 Ps . .# Ps . .1 #amming: IAMM2N& (N) returns the N:point s(mmetric Iamming 'indo' in a column

;N8 Pn> . !"TTEHD (Pp8 Ps8 Hp8 Hs8NsN) does the computation for an analog filter8 in 'hich case Pp and Ps are in radiansGsecond !and pass: Pp . ;.# .F>8 Ps . ;.1 .@> !and stop: Pp . ;.1 .@>8 Ps . ;.# .F> !"TTEHD also returns Pn8 the !utter'orth natural freAuenc( (or8 the Z$ d! freAuenc(Z) to use 'ith !"TTEH to achieBe the specifications.

:utter : !utter'orth digital and analog filter design. ;!8A> . !"TTEH (N8Pn) designs an Nth order lo' pass digital !utter'orth filter and returns the filter coefficients in length freAuenc( rate. 2f Pn is a t'o:element Bector8 Pn . ;P1 P#>8 !"TTEH returns an Erder #N band pass filter 'ith pass band P1 1 P 1 P#. ;!8 A> . !"TTEH (N8 Pn89high9) designs a high pass filter. ;!8 A> . !"TTEH (N8 Pn89lo'9) designs a lo' pass filter. ;!8 A> . !"TTEH (N8 Pn89stop9) is a band stop filter if Pn . ;P1 P#>. 7re8 : aplace:transform (s:domain) freAuenc( response. I . 5HEX* (!8 A8 P) returns the complex freAuenc( response Bector I of the filter !GA: &iBen the numerator and denominator coefficients in Bectors ! and A. The freAuenc( response is eBaluated at the points specified in Bector P (in radGs). The magnitude and phase can be graphed b( calling 5HEX* (!8 A8 P) 'ith no output arguments. ;I8 P> . 5HEX* (!8 A) automaticall( picDs a set of #00 freAuencies P on 'hich the freAuenc( response is computed. 5HEX* (!8 A8 N) picDs N freAuencies. N=1 Bectors ! (numerator) and A (denominator). The coefficients are listed in descending po'ers of <. The cutoff Pn must be 0.0 1 Pn 1 1.08 'ith 1.0 corresponding to half the sample

You might also like