Sie sind auf Seite 1von 83

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. 1

ARCHITECTURE AND INSTRUCTION SET OF DSPCHIP-TMS3 !C"#13

FEATURES OF HI$HEST-PERFORMANCE FLOATIN$-POINT DI$ITAL SI$NAL PROCESSOR TMS3 !C"#13

Enhanced Harvard Architecture VLIW Parallel Architecture Rich Addressing modes Two general purpose Register files(A !A"# $ % !%"#& '()*+! %it ,ata Word Rich Instruction set Eight '(!%it Instructions)-.cle '()*+!%it ,ata Word " ,epartment of E-E -/R Institute of Technolog.

" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual +0+!1 *02!ns Instruction -.cle Time "3 /IP4)"'# /5L6P4

Rich Peripheral 4et1 6ptimi7ed for Audio Highl. 6ptimi7ed -)-88 -ompiler

TMS3 !C"#13 ARCHITECTURE

( ,epartment of E-E -/R Institute of Technolog.

( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

INSTRUCTION SET FEATURES 9 4ingle! and ,ou:le!Precision Instructions 9 %.te!Addressa:le (3!1 "*!1 '(!%it ,ata& 9 3!%it 6verflow Protection

' ,epartment of E-E -/R Institute of Technolog.

' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

9 4aturation; %it!5ield E<tract1 4et1 -lear; %it!-ounting; =ormali7ation

C"#X INSTRUCTION SET

+ ,epartment of E-E -/R Institute of Technolog.

+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

TMS3 !C"#13 DSP FEATURES


Highest!Performance 5loating!Point ,igital 4ignal Processor (,4P&> Eight '(!%it Instructions)-.cle '()*+!%it ,ata Word ' (+ !1 )"3 %!1 ( 1 "3 !/H7 (?,P&1 and )"'# 1 "* )"( %-1 ( !1 "*2!/H7 (P@P& -locA Rates /IP4 )/5L6P4 -/R Institute of Technolog. '0'!1 +0+!1 #!1 *!Instruction -.cle Times 1 and "''*)" # ,epartment of E-E

# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual Rich Peripheral 4et1 6ptimi7ed for Audio Highl. 6ptimi7ed -)-88 -ompiler E<tended Temperature ,evices Availa:le Advanced Ver. Long Instruction Word (VLIW& T/4'( -*2<B ,4P -ore Eight Independent 5unctional Cnits> Two ALCs (5i<ed!Point& 5our ALCs (5loating! and 5i<ed!Point& Two /ultipliers (5loating! and 5i<ed!Point& Load!4tore Architecture With '( '(!%it ?eneral!Purpose Registers Instruction PacAing Reduces -ode 4i7e All Instructions -onditional Instruction 4et 5eatures =ative Instructions for IEEE 2#+ 4ingle! and ,ou:le!Precision %.te!Addressa:le (3!1 "*!1 '(!%it ,ata& 3!%it 6verflow Protection 4aturation; %it!5ield E<tract1 4et1 -lear; %it!-ounting; =ormali7ation L")L( /emor. Architecture +D!%.te L"P Program -ache (,irect!/apped& +D!%.te L", ,ata -ache ((!Wa.& (#*D!%.te L( /emor. Total> *+D!%.te L( Cnified -ache)/apped RA/1 and "E(D!%.te Additional L( /apped RA/ ,evice -onfiguration %oot /ode> HPI1 3!1 "*!1 '(!%it R6/ %oot Endianness> Little Endian1 %ig Endian '(!%it E<ternal /emor. Interface (E/I5& ?lueless Interface to 4RA/1 EPR6/1 5lash1 4%4RA/1 and 4,RA/ #"(/!%.te Total Addressa:le E<ternal /emor. 4pace * ,epartment of E-E -/R Institute of Technolog.

* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual Enhanced ,irect!/emor.!Access (E,/A& -ontroller ("* Independent -hannels& "*!%it Host!Port Interface (HPI& Two /ultichannel Audio 4erial Ports (/cA4Ps& Two Independent -locA Fones Each (" TG and " RG& Eight 4erial ,ata Pins Per Port> Individuall. Assigna:le to an. of the -locA Fones Each -locA Fone Includes> Programma:le -locA ?enerator Programma:le 5rame 4.nc ?enerator T,/ 4treams 5rom (!'( Time 4lots 4upport for 4lot 4i7e> 31 "(1 "*1 ( 1 (+1 (31 '( %its ,ata 5ormatter for %it /anipulation Wide Variet. of I(4 and 4imilar %it 4tream 5ormats Integrated ,igital Audio Interface Transmitter (,IT& 4upports> 4)P,I51 IE-* E#3!"1 AE4!'1 -P!+' 5ormats Cp to "* transmit pins Enhanced -hannel 4tatus)Cser ,ata E<tensive Error -hecAing and Recover. Two Inter!Integrated -ircuit %us (I(- %usB& /ulti!/aster and 4lave Interfaces Two /ultichannel %uffered 4erial Ports> 4erial!Peripheral!Interface (4PI& High!4peed T,/ Interface A-E2 Interface Two '(!%it ?eneral!Purpose Timers ,edicated ?PI6 /odule With "* pins (E<ternal Interrupt -apa:le& 5le<i:le Phase!LocAed!Loop (PLL& %ased -locA ?enerator /odule IEEE!""+E0" (HTA? & %oundar.!4can!-ompati:le 2 ,epartment of E-E -/R Institute of Technolog.

2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual PacAage 6ptions> ( 3!Pin PowerPA,B Plastic (Low!Profile& Iuad 5latpacA (P@P& (2(!%?A PacAages (?,P and F,P& 0"'!Jm)*!Level -opper /etal Process -/64 Technolog. '0'!V I)6s1 "0( !V Internal (?,P $ P@P& /H7 onl.&

'0'!V I)6s1 "0+!V Internal (?,P&('

&LOC' DIA$RAM

3 ,epartment of E-E -/R Institute of Technolog.

3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual TMS3 !C"#13 DS' O()r(*)+ &lo,- D*a.ra/ INTRODUCTION TO CODE COMPOSER STUDIO -ode -omposer is the ,4P industr.Ks first full. integrated development environment (I,E& with ,4P!specific functionalit.0 With a familiar environment liAed /4!:ased -88T/1 -ode -omposer lets .ou edit1 :uild1 de:ug1 profile and manage proLects from a single unified environment0 6ther uniMue features include graphical signal anal.sis1 inLection)e<traction of data signals via file I)61 multi!processor de:ugging1 automated testing and customi7ation via a -!interpretive scripting language and much more0 CODE COMPOSER FEATURES INCLUDE0 I,E ,e:ug I,E Advanced watch windows Integrated editor 5ile I)61 Pro:e Points1 and graphical algorithm scope pro:es Advanced graphical signal anal.sis Interactive profiling Automated testing and customi7ation via scripting Visual proLect management s.stem -ompile in the :acAground while editing and de:ugging /ulti!processor de:ugging Help on the target ,4P

EXPERIMENT No.
AIM0 To verif. the linear convolution operation Csing ,4D -ode composer studio E1UIPMENTS NEEDED0

E ,epartment of E-E -/R Institute of Technolog.

E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D). INTRODUCTION0 Linear -onvolution involves the following operations0 "0 5olding (0 /ultiplication '0 Addition +0 4hifting These operations can be represented by a Mathematical Expression as follows: &0

<N OP Input signal 4amples hN OP Impulse response co!efficient0 .N OP -onvolution output0 n P =o0 of Input samples h P =o0 of Impulse response co!efficient0 E.0 <NnO P Q"1 (1 '1 +R hNAO P Q"1 (1 '1 +R " ,epartment of E-E -/R Institute of Technolog.

" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Where> nP+1 AP+0 multiples of + rP n8A!" P 20

;Values of n $ A should :e a multiple of +0 If n $ A are not multiples of +1 pad with 7eroSs to maAe ; 4i7e of output seMuence0

P +8+!"

rP nP " ( ' Out2ut> <N OhN O

"

( <N OhN"O <N"OhN"O <N(OhN O

' <N OhN(O <N"OhN(O <N(OhN"O <N'OhN O

+ <N OhN'O <N"OhN'O <N(OhN(O

<N"OhN O

<N(OhN'O <N'OhN(O <N'OhN'O

<N'OhN"O

.NrO P Q "1 +1 " 1 ( 1 (#1 (+1 "*R0

NOTE0 At the end of input seMuences pad TnS and TAS no0 of 7eroSs PROCEDURE0 6pen -ode -omposer 4tudio1 maAe sure the ,4P Ait is turned on0 4tart a new proLect using TProLect!new T pull down menu1 save it in a separate director.(c>UtiUm.proLects& with name lconv0pLt0 "" ,epartment of E-E -/R Institute of Technolog.

"" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Add the source files conv0asm0 to the proLect using TProLectadd files to proLectS pull down menu0 Add the linAer command file hello0cmd0 (Path> c>UtiUtutorialUdsA*2"'Uhello"Uhello0cmd& Add the run time support li:rar. file rts*2 (Path> c>UtiUc* UcgtoolsUli:Urts*2 0li:0 0li:&

-ompile the program using the TProLect!compileS pull down menu or :. clicAing the shortcut icon on the left side of program window0 %uild the program using the TProLect!%uildS pull down menu or :. clicAing the shortcut icon on the left side of program window0 Load the program (lconv0out& in program memor. of ,4P chip using the T5ile!load programS pull down menu0 To View output graphicall. 4elect view graph time and freMuenc.0 PRO$RAMMIN$ FOR LINEAR CON3OLUTION IN 4C5 LAN$UA$E0

VincludeWstdio0hX main(& Q int mP+; )9Lenght of i)p samples seMuence9) "( ,epartment of E-E -/R Institute of Technolog.

"( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual int nP+; int iP 1L; int <N" OPQ"1(1'1+1 1 1 1 R; )9Input 4ignal 4amples9) int hN" OPQ"1(1'1+1 1 1 1 R; )9Impulse Response -o!efficients9) )9At the end of input seMuences pad T/S and T=S no0 of 7eroSs9) int .N" O; for(iP ;iWm8n!";i88& Q .NiOP ; for(LP ;LWPi;L88& .NiO8P<NLO9hNi!LO; R for(iP ;iWm8n!";i88& printf(YZdUnY1.NiO&; R )9Lenght of impulse response -o!efficients 9)

RESULT0 -onfigure the graphical window as shown :elow INPUT <NnO P Q"1 (1 '1 +1 1 1 1 R hNAO P Q"1 (1 '1 +1 1 1 1 R OUTPUT:

"' ,epartment of E-E -/R Institute of Technolog.

"' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Note: "0 To e<ecute the a:ove program follow [ procedure to worA on code composer studio\ (0 To view graphical output follow the a:ove procedure0

1UESTIONS
"0 What is the reMuirement for convolution]0 (0 What is the difference :etween convolution $ correlation] '0 What is meant :. impulse response] +0 Is it possi:le to represent an. discrete time signal in terms of impulses] If .es1 represent :. using e<ample0 #0 ,raw the h((n!A& $ h(n!(A& for the following seMuence h(n& P Q + ' ( "R assume (i& AP ' (ii& A P#0 *0 Write the e<pressions for LTI s.stem convolution formula $ causal LTI s.stem convolution formula0 "+ ,epartment of E-E -/R Institute of Technolog.

"+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 20 What us the length of linear convolution if length of input $ impulse responses are =" $ =( respectivel.] 30 What is the difference :etween continuous and discrete convolution]

"# ,epartment of E-E -/R Institute of Technolog.

"# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. 3
AIM0 To verif. the circular convolution operation Csing ,4D -ode composer studio0 E1UIPMENTS NEEDED0 "* ,epartment of E-E -/R Institute of Technolog.

"* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D&0 -R61 5unction ?enerators1 -onnecting wires

&0

INTRODUCTION:

Steps for circular Convolution


4teps for circular convolution are the same as the usual convolution1 e<cept all inde< calculations are done Ymod =Y P Yon the wheelY 4teps for -.clic -onvolution 4tep"> [Plot fNmO and hN^mO

4u:figure "0" 4u:figure "0( 4tep (> Y4pinY hN^mO n times Anti -locA Wise (counter!clocAwise& to get hNn! mO (i0e0 4impl. rotate the seMuence1 hNnO1 clocAwise :. n steps&

5igure (> 4tep ( "2 ,epartment of E-E -/R Institute of Technolog.

"2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

4tep '> Point wise multipl. the fNmO wheel and the hNn^mO wheel0 sumPyNnO 4tep +> Repeat for all _n_N^" E<ample "> -onvolve (n P +&

4u:figure '0" 4u:figure '0( 5igure '> Two discrete!time signals to :e convolved0

hN^mO P

5igure + /ultipl. fNmO and sum to .ield> yN O P' hN"^mO

5igure # /ultipl. fNmO and sum to .ield> yN"O P# hN(^mO "3 ,epartment of E-E -/R Institute of Technolog.

"3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

5igure * /ultipl. fNmO and sum to .ield> yN(O P' hN'^mO

5igure 2 /ultipl. fNmO and sum to .ield> yN'O P"

PROCEDURE0 6pen -ode -omposer 4tudio; maAe sure the ,4P Ait is turned on0 4tart a new proLect using TProLect!new T pull down menu1 save it in a separate director.(c>UtiUm.proLects& with name ,*r ,on(.26t. Add the source files C*r,ular Con(olut*on.C. to the proLect using TProLectadd files to proLectS pull down menu0 Add the linAer command file 7)llo.,/8 0 "E ,epartment of E-E -/R Institute of Technolog.

"E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual (Path> c>UtiUtutorialUdsA*2"'Uhello"Uhello0cmd& Add the run time support li:rar. file rt9"#!!.l*b (Path> c>UtiUc* UcgtoolsUli:Urts*2 0li:&

-ompile the program using the TProLect!compileS pull down menu or :. clicAing the shortcut icon on the left side of program window0 %uild the program using the TProLect!%uildS pull down menu or :. clicAing the shortcut icon on the left side of program window0 Load the program(lconv0out& in program memor. of ,4P chip using the T5ile!load programS pull down menu0

( ,epartment of E-E -/R Institute of Technolog.

( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual PRO$RAMMIN$ FOR CIRCULAR CON3OLUTION IN 4C5 LAN$UA$E0

:*n,lu8);9t8*o.7< *nt /=n=>?3!@=7?3!@=y?3!@=*=6=t)/2?3!@=-=> ?3!@=a?3!@A (o*8 /a*nBC D 2r*ntEBF )nt)r t7) l)n.t7 oE t7) E*r9t 9)Gu)n,)HnFCA 9,anEBFI8F=J/CA 2r*ntEBF )nt)r t7) l)n.t7 oE t7) 9),on8 9)Gu)n,)HnFCA 9,anEBFI8F=JnCA 2r*ntEBF )nt)r t7) E*r9t 9)Gu)n,)HnFCA EorB*K!A*;/A*LLC 9,anEBFI8F=J>?*@CA 2r*ntEBF )nt)r t7) 9),on8 9)Gu)n,)HnFCA EorB6K!A6;nA6LLC 9,anEBFI8F=J7?6@CA *EB/-nMK!C D (" ,epartment of E-E -/R Institute of Technolog. NOIE l)n.t7 oE bot7 9)Gu)n,)9 ar) not )GualON

(" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual *EB/<nC D EorB*KnA*;/A*LLC 7?*@K!A nK/A Q EorB*K/A*;nA*LLC >?*@K!A /KnA Q y?!@K!A a?!@K7?!@A EorB6K1A6;nA6LLC a?6@K7?n-6@A NOC*r,ular ,on(olut*onON EorB*K!A*;nA*LLC y?!@LK>?*@Oa?*@A EorB-K1A-;nA-LLC (( ,epartment of E-E -/R Institute of Technolog. NOEol8*n. 7BnC to 7B-nCON NO Pa8 t7) 9/all)r 9)Gu)n,) +*t7 P)roON

(( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual D y?-@K!A NO,*r,ular 97*EtON EorB6K1A6;nA6LLC > ?6@Ka?6-1@A > ?!@Ka?n-1@A EorB*K!A*;nA*LLC D a?*@K> ?*@A y?-@LK>?*@O> ?*@A Q Q NO8*92lay*n. t7) r)9ultON 2r*ntEBF t7) ,*r,ular ,on(olut*on *9HnFCA EorB*K!A*;nA*LLC 2r*ntEBFI8 HtF=y?*@CA

(' ,epartment of E-E -/R Institute of Technolog.

(' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

RE4CLT> IN PUT0 E.0 >?R@KD3= = 1=!Q 7?R@KD1= 1= !=!Q OUT PUT0 y?R@KD3= %= 3=!Q

ICE4TI6=4
"0 Wh. we need circular convolution] (0 What is the difference :etween circular $ linear convolution] '0 What is the length of output seMuence after circular convolution if the lengths of input $ impulse responses are /" $ /( respectivel.] +0 4tate the circular convolution propert. of ,5T] #0 Where we reMuired convolution propert.] (+ ,epartment of E-E -/R Institute of Technolog.

(+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual *0 What does 7ero padding mean] Where we reMuired this concept] 20 What is difference :etween linear shifting $ circular shifting of signal] 4how with e<ample0 30 What is difference :etween linear $ circular folding of signal] 4how with e<ample0 E0 What is the advantage with sectioned convolution]0

(# ,epartment of E-E -/R Institute of Technolog.

(# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. R

AIM0 ,esign 5IR filter(LP)HP&and verif. with different cutoff freMuencies using matla: software0 E1UIPMENTS0 Host (P-& with windows (E#)E3)/e)GP)=T)( AL$ORITHM0 ". $)t t7) 2a99 ban8 an8 9to2 ban8 r*22l)9. . $)t t7) 2a99 ban8 an8 9to2 ban8 )8.) Er)Gu)n,*)9. 3. $)t t7) 9a/2l*n. Er)Gu)n,y. R. Cal,ulat) t7) or8)r oE t7) E*lt)r. %. F*n8 t7) +*n8o+ ,o)EE*,*)nt9. ". Dra+ t7) /a.n*tu8) an8 27a9) r)92on9)9. (* ,epartment of E-E -/R Institute of Technolog. &1 matla: software

(* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual PRO$RAMME0 IPro.ra/ Eor FIR LPF u9*n. bla,-/an +*n8o+ nK !A E2K !!A EGK3!!A E9K1!!!A EnK OE2NE9A +*n8o+Kbla,-/anBnL1CA bKE*r1Bn=En=+*n8o+CA ?H S@KEr)GPBb=1=1 TCA 9ub2lotB =1=1CA 2lotBSN2*=ab9BHCCA t*tl)BU/a.n*tu8) r)92on9) oE l2EUCA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA 2lotBSN2*=an.l)BHCCA t*tl)BU27a9) r)92on9) oE l2EUCA ylab)lBUan.l)--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA

R)9ult0

(2 ,epartment of E-E -/R Institute of Technolog.

(2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

+*n8o+ K -!.!!!! !.!!V !.!R! !.1!1R !. !!T !.3R!! !.%!VT !."TV !.TRV !.V"! 1.!!!! !.V"! !.TRV !."TV !.%!VT !.3R!! !. !!T !.1!1R !.!R! !.!!V -!.!!!! b K !.!!!! -!.!!!3 -!.!!!V -!.!!!! -!.!3T" -!.!R3! !.3VVV -!.!!!! !.!!!! !. V!" !.!1!1 !.!! # !.!#VR !.!1!1 !. V!"

!.!#VR -!.!R3! -!.!3T" !.!! # -!.!!!V -!.!!!3

(3 ,epartment of E-E -/R Institute of Technolog.

(3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

FIR LOS PASS FILTER DESI$N USIN$ RECTAN$LE SINDOS 0 IPro.ra/ Eor FIR LPF u9*n. r),tan.ular +*n8o+ nK !A E2K !!A EGK3!!A E9K1!!!A EnK OE2NE9A +*n8o+Kr),t+*nBnL1CA bKE*r1Bn=En=+*n8o+CA ?H S@KEr)GPBb=1=1 TCA 9ub2lotB =1=1CA 2lotBSN2*=ab9BHCCA t*tl)BU/a.n*tu8) r)92on9) oE l2EUCA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA 2lotBSN2*=an.l)BHCCA t*tl)BU27a9) r)92on9) oE l2EUCA ylab)lBUan.l)--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA

(E ,epartment of E-E -/R Institute of Technolog.

(E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

RESULT0-

+*n8o+ K -!.!!!! !.!!V !.!R! !.1!1R !. !!T !.3R!! !.%!VT !."TV !.TRV !.V"! 1.!!!! !.V"! !.TRV !."TV !.%!VT !.3R!! !. !!T !.1!1R !.!R! !.!!V -!.!!!! bK ' ,epartment of E-E -/R Institute of Technolog.

' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual !.!!!! -!.!!!3 -!.!!!V -!.!!!! -!.!3T" -!.!R3! !.3VVV -!.!!!! !.!!!! !. V!" !.!1!1 !.!! # !.!#VR !.!1!1 !. V!"

!.!#VR -!.!R3! -!.!3T" !.!! # -!.!!!V -!.!!!3

FIR LOS PASS FILTER DESI$N USIN$ TRIAN$LE SINDOS0


I2ro.ra/ Eor FIR LPF u9*n. tr*an.ular +*n8o+ nK !A E2K !!A EGK3!!A E9K1!!!A EnK OE2NE9A +*n8o+Ktr*an.BnL1CA bKE*r1Bn=En=+*n8o+CA ?H S@KEr)GPBb=1=1 TCA 9ub2lotB =1=1CA 2lotBSN2*=ab9BHCCA t*tl)BU/a.n*tu8) r)92on9) oE l2EUCA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA '" ,epartment of E-E -/R Institute of Technolog.

'" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 2lotBSN2*=an.l)BHCCA t*tl)BU27a9) r)92on9) oE l2EUCA ylab)lBUan.l)--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA

RESULT0-

'( ,epartment of E-E -/R Institute of Technolog.

'( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

+*n8o+ K -!.!!!! !.!!V !.!R! !.1!1R !. !!T !.3R!! !.%!VT !."TV !.TRV !.V"! 1.!!!! !.V"! !.TRV !."TV !.%!VT !.3R!! !. !!T !.1!1R !.!R! !.!!V -!.!!!! bK !.!!!! -!.!!!3 -!.!!!V -!.!!!! -!.!3T" -!.!R3! !.3VVV ,epartment of E-E !. V!" !.!! # !.!#VR !.!1!1 !. V!"

!.!#VR -!.!R3! -!.!3T" '' -/R Institute of Technolog.

'' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual -!.!!!! !.!1!1 !.!!!! !.!! # -!.!!!V -!.!!!3

EXPERIMENT No. %

AIM0 To verif. the IIR filter Csing ,4D -ode composer studio with T/4'( -*2"' Ait0 E1UIPMENTS0 Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D). PROCEDURE0 6pen -ode -omposer 4tudio; maAe sure the ,4P Ait is turned on0 -reate a new proLect Initiali7e on :oard codec0 Add the given a:ove T-S source file to the current proLect(remove codec0c source file from the proLect if .ou have alread. added& %uild the program Load the generated o:Lect file (90out& on to target :oard0 Run the program using 5#1 6:serve the waveform on the -R6 screen0 &0

'+ ,epartment of E-E -/R Institute of Technolog.

'+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

PRO$RAME FOR IIR FILTER0

#include "filtercfg.h" #include "dsk6713.h" #include "dsk6713_aic23.h" const signed int filter_Coeff[] = { 1273!"#1273!"1273!"2767"#1$32%"21137 &'( 2)!! & 312"312"312"32767"#27*%3"2%367 &+( $!! & 1%))"1%))"1%))"32767"#231%!"2173) &+( 2)!! & *26$"#*26$"*26$"32767"#73*)"1$367 &'( %!!!& 721)"#721)"721)"32767")!3*"6171" &'( 7!!!& , & Codec configuration settings & ./06713_12C23_Config config = { 3 !4!!17" & ! ./06713_12C23_+567289:+ <olu=e & 3 !4!!17" & 1 ./06713_12C23_>2?'7289:+ <olu=e & 3 !4!!d$" & 2 ./06713_12C23_+567'(9:+ <olu=e & 3 !4!!d$" & 3 ./06713_12C23_>2?'7'(9:+ <olu=e & 3 !4!!11" & % ./06713_12C23_181(17' & 3 !4!!!!" & ) ./06713_12C23_.2?(17' & 3 !4!!!!" & 6 ./06713_12C23_(:@5>.:@8 3 !4!!%3" & 7 ./06713_12C23_.2?26 for=at & 3 !4!!$1" & $ ./06713_12C23_/1B(+5>175 3 !4!!!1 & * ./06713_12C23_.2?1C7 acti<ation & 3 ,-

+eft line in;ut channel >ight line in;ut channel +eft channel head;hone >ight channel head;hone 1nalog audio ;ath control .igital audio ;ath control (oAer doAn control & .igital audio interface /a=;le rate control & .igital interface

& & =ainCD # Bain code routine" initialiEes F/+ and generates tone & <oid =ainCD {

'# ,epartment of E-E -/R Institute of Technolog.

'# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual


./06713_12C23_Codec'andle hCodecint l_in;ut" r_in;ut" l_out;ut" r_out;ut& 2nitialiEe the Goard su;;ort liGrarH" =ust Ge called first & ./06713_initCD& /tart the codec & hCodec = ./06713_12C23_o;enCodecC!" IconfigD./06713_12C23_set6reJChCodec" 3DAhileC1D { & >ead a sa=;le to the left channel & Ahile CK./06713_12C23_readChCodec" Il_in;utDD& >ead a sa=;le to the right channel & Ahile CK./06713_12C23_readChCodec" Ir_in;utDDl_out;ut=22>_62+75>CIfilter_Coeff "l_in;utDr_out;ut=l_out;ut& /end a sa=;le to the left channel & Ahile CK./06713_12C23_AriteChCodec" l_out;utDD& /end a sa=;le to the right channel & Ahile CK./06713_12C23_AriteChCodec" r_out;utDD, & Close the codec & ./06713_12C23_closeCodecChCodecD, signed int 22>_62+75>Cconst signed int & h" signed int 41D { static signed int 4[6] = { !" !" !" !" !" ! ,& 4CnD" 4Cn#1D" 4Cn#2D. Bust Ge static & static signed int H[6] = { !" !" !" !" !" ! ,& HCnD" HCn#1D" HCn#2D. Bust Ge static & int te=;=!te=; = Cshort intD41& Co;H in;ut to te=; & & Co;H in;ut to 4[stages][!] & & F! & 4CnD &

4[!] = Csigned intD te=;te=; =

C CintDh[!] & 4[!]D -

te=; L= C CintDh[1] & 4[1]Dte=; L= C CintDh[1] & 4[1]D-

& F1 2 & 4Cn#1D & & F1 2 & 4Cn#1D &

'* ,epartment of E-E -/R Institute of Technolog.

'* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual


te=; L= C CintDh[2] & 4[2]Dte=; #= C CintDh[%] & H[1]Dte=; #= C CintDh[%] & H[1]Dte=; #= C CintDh[)] & H[2]D& F2 & 4Cn#2D & & 11 2 & HCn#1D & & 11 2 & HCn#1D & & 12 & HCn#2D &

& .i<ide te=; GH coefficients[1!] & te=; MM= 1)if C te=; M 32767 D { te=; = 32767, else if C te=; N #32767D { te=; = #32767, H[!] = te=; & /huffle <alues along one ;lace for ne4t ti=e & H[2] = H[1]H[1] = H[!]4[2] = 4[1]4[1] = 4[!]& HCn#2D = HCn#1D & & HCn#1D = HCnD & & 4Cn#2D = 4Cn#1D & & 4Cn#1D = 4CnD &

& te=; is used as in;ut ne4t ti=e through & return Cte=;NN2D-

'2 ,epartment of E-E -/R Institute of Technolog.

'2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. "

AIM0

To find the ,5T of a seMuence using =!Point 55T algorithm using T/4'( -*2"' ,4P processor0

E1UIPMENTS NEEDED0 Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D&0 6scilloscope and 5unction generator0 &0

INTRODUCTION0

The ,5T EMuation

'3 ,epartment of E-E -/R Institute of Technolog.

'3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Twiddle Factor In the ,efinition of the ,5T1 there is a factor called the Twiddle Factor

where = P num:er of samples0 If we taAe an 3 :it sample seMuence we can represent the twiddle factor as a vector in the unit circle0 e0g0

0 PROCEDURE0 6pen -ode -omposer 4tudio1 maAe sure the ,4P Ait is turned on0 'E ,epartment of E-E -/R Institute of Technolog.

'E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 4tart a new proLect using TProLect!new T pull down menu1 save it in a separate director.(c>UtiUm.proLects& with name [FFT.26tW. Add the source files [FFT %".,[ and XFFT.CW in the proLect using TProLectadd files to proLectS pull down menu0 Add the linAer command file [7)llo.,/8W. Add the rts file Xrt9"#!!.l*bW . -ompile the program using the TProLect!compileS pull down menu or :. clicAing the shortcut icon on the left side of program window0 Load the program in program memor. of ,4P chip using the T5ile!load programS pull down menu0 Run the program and o:serve output using graph utilit.0

PRO$RAM FOR IMPLEMENTATION0 /ain0c (fft (#*0c&> Vinclude Wmath0hX Vdefine PT4 *+ + ,epartment of E-E -/R Institute of Technolog. ))V of points for 55T

+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual Vdefine PI '0"+"#E(*#'#3E2E

t.pedef struct Qfloat real1imag;R -6/PLEG;

void 55T(-6/PLEG 9@1 int n&; float io:ufferNPT4O; float <"NPT4O; short i; short :uffercount P ; short flag P ; -6/PLEG wNPT4O; -6/PLEG samplesNPT4O; main(& Q for (i P ; iWPT4 ; i88& Q

))55T protot.pe ))as input and output :uffer

))intermediate :uffer ))general purpose inde< varia:le ))num:er of new samples in io:uffer ))set to " :. I4R when io:uffer full ))twiddle constants stored in w ))primar. worAing :uffer

)) set up twiddle constants in w

wNiO0real P cos((9PI9i)(PT49(0 &&; ))Re component of twiddle constants wNiO0imag P!sin((9PI9i)(PT49(0 &&; ))Im component of twiddle constants R

for (i P ; i W PT4 ; i88& Q

))swap :uffers

io:ufferNiO P sin((9PI9" 9i)*+0 &;)9" ! X freM1 *+ !X sampling freM9) +" ,epartment of E-E -/R Institute of Technolog.

+" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual samplesNiO0realP 0 ; samplesNiO0imagP 0 ; R

for (i P ; i W PT4 ; i88& Q

))swap :uffers

samplesNiO0realPio:ufferNiO; )):uffer with new data R for (i P ; i W PT4 ; i88& samplesNiO0imag P 0 ; 55T(samples1PT4&; for (i P ; i W PT4 ; i88& Q <"NiO P sMrt(samplesNiO0real9samplesNiO0real 8 samplesNiO0imag9samplesNiO0imag&; R R ))end of main ))imag components P ))call function 55T0c ))compute magnitude

EEt.,0
Vdefine PT4 *+ e<tern -6/PLEG wNPT4O; +( ,epartment of E-E -/R Institute of Technolog. ))V of points for 55T ))twiddle constants stored in w t.pedef struct Qfloat real1imag;R -6/PLEG;

+( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

void 55T(-6/PLEG 9@1 int =& ))input sample arra.1 V of points Q -6/PLEG temp"1temp(; int i1L1A; int leg`diff; int num`stages P ; int inde<1 step; i P "; do Q num`stages 8P"; i P i9(; Rwhile (iaP=&; leg`diff P =)(; step P (PT49(&)=; Q inde< P ; for (L P ; L W leg`diff; L88& Q for (upper`leg P L; upper`leg W =; upper`leg 8P ((9leg`diff&& Q lower`leg P upper`leg8leg`diff; temp"0real P (@Nupper`legO&0real 8 (@Nlower`legO&0real; temp"0imag P (@Nupper`legO&0imag 8 (@Nlower`legO&0imag; +' ,epartment of E-E -/R Institute of Technolog. ))difference :etween upper$lower legs ))step :etween values in twiddle0h int upper`leg1 lower`leg; ))temporar. storage varia:les ))inde< of upper)lower :utterfl. leg ))num:er of 55T stages (iterations& ))inde<)step through twiddle constant ))log(:ase(& of = pointsP V of stages ))loop counter varia:les ))difference :etween upper)lower leg

for (i P ;i W num`stages; i88& ))for =!point 55T

+' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual temp(0real P (@Nupper`legO&0real ! (@Nlower`legO&0real; temp(0imag P (@Nupper`legO&0imag ! (@Nlower`legO&0imag; (@Nlower`legO&0real P temp(0real9(wNinde<O&0real !temp(0imag9(wNinde<O&0imag; (@Nlower`legO&0imag P temp(0real9(wNinde<O&0imag 8temp(0imag9(wNinde<O&0real; (@Nupper`legO&0real P temp"0real; (@Nupper`legO&0imag P temp"0imag; R inde< 8P step; R leg`diff P leg`diff)(; step 9P (; R LP ; for (i P "; i W (=!"&; i88& Q A P =)(; while (A WP L& Q L P L ! A; A P A)(; R L P L 8 A; if (iWL& Q temp"0real P (@NLO&0real; ++ ,epartment of E-E -/R Institute of Technolog. )):it reversal for reseMuencing data

++ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual temp"0imag P (@NLO&0imag; (@NLO&0real P (@NiO&0real; (@NLO&0imag P (@NiO&0imag; (@NiO&0real P temp"0real; (@NiO&0imag P temp"0imag; R R return; R RESULT0 In2ut0

6CTPCT>

+# ,epartment of E-E -/R Institute of Technolog.

+# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

1UESTION
"0 What is the difference :etween continuous time $ discrete time 5ourier transform] (0 What is the condition for convergence of 5ourier transform] '0 What is the difference :etween discrete Time 5ourier Transform (,T5T&$ ,5T] +0 What is the difference :etween F transform $ ,5T] #0 4tate convolution propert. of the ,5T] Where we could use the convolution propert.] *0 4tate ParsevalSs theorem0] 20 4tate correlation propert. of the ,5T0]

EXPERIMENT No. # AIM0


+* ,epartment of E-E -/R Institute of Technolog.

+* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual ?enerate sum of sinusoidal seMuences

E1UIPMENTS0
Host (P-& with windows (E#)E3)/e)GP)=T)( &0matla: software0

PRO$RAME0
I2ro.ra/ to .)n)rat) 9*nu9o*8al 9*.nal9 +*t7 8*EE)r)nt a/2l*tu8)9 t*tl)BU9*n) +a()9UCA tK!0.%0 O2*A yK9*nBtC y1K%O9*nBtC y K1!O9*nBtC y3K1%O9*nBtC 9ub2lotBR= =1CA 2lotByCA >lab)lBUt*/)UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= = CA 9t)/ByC >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= =3CA 2lotBy1CA >lab)lBUt*/)UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= =RCA 9t)/By1C >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA +2 ,epartment of E-E -/R Institute of Technolog.

+2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 9ub2lotBR= =%CA 2lotBy CA >lab)lBUt*/)UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= ="CA 9t)/By C >lab)lBUn---<UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= =#CA 2lotBy3CA >lab)lBUt*/)UCA ylab)lBUa/2l*tu8)UCA 9ub2lotBR= =TCA 9t)/By3C >lab)lBUn--<UCA lab)lBUa/2l*tu8)UCA

RE4CLT4> ?E=ERATI6= 65 4I=C46I,AL 4I?=AL

+3 ,epartment of E-E -/R Institute of Technolog.

+3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

I2ro.ra/ to .)n)rat) 9u/ oE 9*n) 9)Gu)n,)9 t*tl)BU9u/ oE 9*n +a()9UCA tK!0.%0 O2*A >K9*nBtCA 9ub2lotBR= =1CA 9t)/B>CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a()UCA 9ub2lotBR= = CA 2lotB>CA +E ,epartment of E-E -/R Institute of Technolog.

+E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a()UCA y1K9*nBtCL%O9*nB OtCA 9ub2lotBR= =3CA 9t)/By1CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 7ar/on*,UCA 9ub2lotBR= =RCA 2lotBy1CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 7ar/on*,UCA y K9*nBtCL%O9*nB OtCL1!O9*nB3OtCA 9ub2lotBR= =%CA 9t)/By CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 t+o 7ar/on*,9UCA 9ub2lotBR= ="CA 2lotBy CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 t+o 7ar/on*,9UCA y3K9*nBtCL%O9*nB OtCL1!O9*nB3OtCL1%O9*nBROtCA 9ub2lotBR= =#CA # ,epartment of E-E -/R Institute of Technolog.

# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 9t)/By3CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 t7r)) 7ar/on*,9UCA 9ub2lotBR= =TCA 2lotBy3CA >lab)lBUn----<UCA ylab)lBUa/2l*tu8)UCA t*tl)BU9*n +a() +*t7 t7r)) 7ar/on*,9UCA

RESULT0-

#" ,epartment of E-E -/R Institute of Technolog.

#" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 1UESTIONS0 "0 what is the difference :etween sin $ cos signals] (0 What is meant :. signal] '0 What is the difference :etween time domain $ freMuenc. domain signal] +0 What is the difference :etween periodic $ a periodic signal0 #0 What is the difference :etween orthogonal and orthonormal signals] *0 What is the need for 5ourier series $ 5ourier transform] 20 What is the difference :etween discrete $ digital signals] 30 What is the difference :etween even signal $ odd signal] E0 What is the difference :etween power signal $ energ. signal] " 0 What is the difference :etween amplitude scaling $ time scaling of a signal] ""0 What is the difference :etween deterministic $ random signal]

#( ,epartment of E-E -/R Institute of Technolog.

#( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. T

AIM0

Verif. 5IR low pass filter)High pass using matla: software0

EICIP/E=T4>
Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D&0 -R61 5unction ?enerators1 -onnecting wires AL$ORITHM0 ". $)t t7) 2a99 ban8 an8 9to2 ban8 r*22l)9. . $)t t7) 2a99 ban8 an8 9to2 ban8 )8.) Er)Gu)n,*)9. 3. $)t t7) 9a/2l*n. Er)Gu)n,y. R. Cal,ulat) t7) or8)r oE t7) E*lt)r. %. F*n8 t7) +*n8o+ ,o)EE*,*)nt9. ". Dra+ t7) /a.n*tu8) an8 27a9) r)92on9)9. PRO$RAME0 &0

&UTTERSORTH IIR ANALO$ LOS PASS FILTER 0


#' ,epartment of E-E -/R Institute of Technolog.

#' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual I2ro.ra/ Eor butt)r +ort7 analo. IIR LPF +1K*n2utBU)nt)r 2a99 ban8 ,utoEE Er)Gu)n,y0UCA + K*n2utBU)nt)r 9to2 ban8 ,utoEE Er)Gu)n,y0UCA r2K*n2utBU)nt)r 2a99 ban8 r*22l) *n 8bUCA r9K*n2utBU)nt)r 9to2 ban8 r*22l) *n 8bUCA E9K*n2utBU)nt)r t7) 9a/2l*n. Er)Gu)n,yUCA +1K O+2NE9A + K O+9NE9A ?N=+n@Kbuttor8B+1=+ =r2=r9=U9UCA I?P=2=-@Kbutt)rBN=+nCA I?b=a@KP2 tEBP=2=-CA ?b=a@Kbutt)rBN=+n=U9UCA +K!0!.!102*A ?7=o/).a@KEr)G9Bb=a=+CA .a*nK !Olo.1!Bab9B7CCA anKan.l)B7CA 9ub2lotB =1=1CA t*tl)BU/a. r)9 oE l2EUCA 2lotBo/).aN2*=.a*nCA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA t*tl)BU2 r)9 l2EUCA 2lotBo/).aN2*=anCA >lab)lBUnor/al*P)8 Er)Gu)n,y----<UCA ylab)lBU27a9) *n ra8*an9----<UCA #+ ,epartment of E-E -/R Institute of Technolog.

#+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

RESULT0-

)nt)r 2a99 ban8 ,utoEE Er)Gu)n,y01%!! )nt)r 9to2 ban8 ,utoEE Er)Gu)n,y03!!! )nt)r 2a99 ban8 r*22l) *n 8b1! )nt)r 9to2 ban8 r*22l) *n 8bR! )nt)r t7) 9a/2l*n. Er)G)n,y#!!! bK aK ! 1.!!!! ! 1.%3# ! ! 1.1T1% ! !.%#%# ## ,epartment of E-E -/R Institute of Technolog. ! !.!!R! !.1T#! !.!3T% !.!!R!

## ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

#* ,epartment of E-E -/R Institute of Technolog.

#* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. V

AIM0 -ompute Power ,ensit. 4pectrum of a seMuence using matla: software0


E1UIPMENTS0

Host (P-& with windows (E#)E3)/e)GP)=T)(

&0 /atla: software

AL$ORITHM0 1. $)t t7) 9*.nal >BnC oE l)n.t7 N *n /atr*> Eor/. . T7) ,orr)lat)8 9*.nal *9 8)not)8 a9 yBnC. 3. yBnC *9 .*()n by t7) Eor/ula.

yBnC K

k =

x ( k & x ( k n&

+7)r) n K - BN-1C to BN-1C R. PSD K FFT B Auto-,orr)lat*on Eun,t*on yBnC C. PRO$RAM0 I2ro.ra/ Eor auto J 298 >K*n2utBU)nt)r t7) 9)Gu)n,)UCA yK>,orrB>=>CA #2 ,epartment of E-E -/R Institute of Technolog.

#2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 9ub2lotB3=1=1CA 9t)/B>CA ylab)lBUA/2l*tu8)---<UCA >lab)lBU n-----<UCA t*tl)BU*n2ut 9)GUCA 9ub2lotB3=1= CA 9t)/ByCA ylab)lBUA/2l*tu8)----.UCA >lab)lBUn----<UCA t*tl)BUauto,orr 9)G Eor *n2utUCA 8*92BUauto,orr 9)G Eor *n2utUCAy NKRA 2KEEtBy=NCA ylab)lBUA/2l*tu8)---<UCA >lab)lBU'-----<UCA t*tl)BU298 oE *n2utUCA 9ub2lotB3=1=3CA 9t)/B2CA 8*92BUt7) 298 EunUCA2

RESULT0-

#3 ,epartment of E-E -/R Institute of Technolog.

#3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

)nt)r t7) 9)Gu)n,) ?1

3@

Auto ,orr)lat*on Eun,t*on


yK 3 T 1 1T 1 T 3

Po+)r 92),tral 8)n9*ty Eun,t*on #E ,epartment of E-E -/R Institute of Technolog.

#E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 2 K ? "R.!!!! - 1." 11 -1!.R1 * R.TV1#* -1.11"% L R.TV1#* 1. 3#" - 1.%%1V* 1UESTIONS0 "0 (0 '0 +0 #0 What is spectrum] What are the applications] What is auto correlation] How to define power spectral densit.0 What is :andwidth] 1. 3#" L 1.%%1V* -1.11"% - 1." 11 L1!.R1 * @

* ,epartment of E-E -/R Institute of Technolog.

* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

EXPERIMENT No. 1!
*" ,epartment of E-E -/R Institute of Technolog.

*" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

AI/> To find the 5ast 5ourier transform of given "!, signal 0

E1UIPMENTS0 Host (P-& with windows (E#)E3)/e)GP)=T)( T/4'( -*2"' ,4P 4tarter Dit (,4D&0 6scilloscope and 5unction generator0 INTRODUCTION0 &0

Why the FFT If .ou looA at the eMuation for the Discrete Fourier Transform .ou will see that it is Muite complicated to worA out as it involves man. additions and multiplications involving comple< num:ers0 Even a simple eight sample signal would reMuire +E comple< multiplications and #* comple< additions to worA out the ,5T0 At this level it is still managea:le1 however a realistic signal could have " (+ samples which reMuires over ( 1 up to unmanagea:le proportions0 http>))www0spd0eee0strath0ac0uA)binteract)fourier)images)fft"0<:mThe 5ast 1 comple< multiplications and additions0 As .ou can see the num:er of calculations reMuired soon mounts

5ourier Transform is a simpl. a method of la.ing out the computation1 which is much faster for large values of =1 where = is the num:er of samples in the

*( ,epartment of E-E -/R Institute of Technolog.

*( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual seMuence0 It is an ingenious wa. of achieving rather than the ,5TKs clums. Pc( timing0 The idea :ehind the 55T is the divide and conquer approach1 to :reaA up the original = point sample into two (= ) (& seMuences0 This is :ecause a series of smaller pro:lems is easier to solve than one large one0 The ,5T reMuires (=! "&c( comple< multiplications and =(=!"& comple< additions as opposed to the 55TKs approach of :reaAing it down into a series of ( point samples which onl. reMuire " multiplication and ( additions and the recom:ination of the points which is minimal0 5or e<ample Seismic Data contains hundreds of thousands of samples and would taAe months to evaluate the ,5T0 Therefore we use the 55T0 FFT Al.or*t7/ The 55T has a fairl. eas. algorithm to implement1 and it is shown step :. step in the list :elow0 ThLis version of the 55T is the ,ecimation in Time /ethod (0 Pad input seMuence1 of = samples1 with FER6Ks until the num:er of samples is the nearest power of two0 e0g0 # samples are padded to #"( ((cE&

'0 %it reverse the input seMuence0 e0g0 ' P "" goes to "" P * +0 -ompute (= ) (& two sample ,5TKs from the shuffled inputs0 See "Shuffled Inputs" #0 -ompute (= ) +& four sample ,5TKs from the two sample ,5TKs0 See "Shuffled Inputs" *0 -ompute (= ) (& eight sample ,5TKs from the four sample ,5TKs0 See "Shuffled Inputs" 20 Cntil the all the samples com:ine into one =!sample ,5T0 *' ,epartment of E-E -/R Institute of Technolog.

*' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

S7uEEl)8 In2ut9 The process of decimating the signal in the time domain has caused the I=PCT samples to :e re!ordered0 5or an 3 point signal the original order of the samples is ! "! #! $! %! &! '! ( %ut after decimation the order is ! %! #! '! "! &! $! ( At first it ma. looA as if there is no order to this new seMuence1 %CT if the num:ers are represented as :inar. a patter soon :ecomes apparent0

*+ ,epartment of E-E -/R Institute of Technolog.

*+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

What has happened is that the :it patterns representing the sample num:er has :een reversed0 This new seMuence is the order that the samples enter the 55T0

AL$ORITHM TO IMPLEMENT FFT0 St)2 1 - 4elect no0 of points for 55T(Eg> *+&0 St)2 Y ?enerate a sine wave of freMuenc. Tf T (eg> " H7 with a sampling

rate P =o0 of Points of 55T(eg0 *+&& using /at7 l*brary Eun,t*on0 St)2 3 - TaAe sampled data and appl. 55T algorithm 0 St)2 R Y Cse ?raph option to view the Input $ 6utput0 St)2 % - Repeat St)2-1 to R for different no0 of points $ freMuencies0 PROCEDURE0 *# ,epartment of E-E -/R Institute of Technolog.

*# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual 6pen -ode -omposer 4tudio1 maAe sure the ,4P Ait is turned on0 4tart a new proLect using TProLect!new T pull down menu1 save it in a separate director.(c>UtiUm.proLects& with name [FFT.26tW. Add the source files [FFT %".,[ and XFFT.CW in the proLect using TProLectadd files to proLectS pull down menu0 Add the linAer command file [7)llo.,/8W. Add the rts file Xrt9"#!!.l*bW . -ompile the program using the TProLect!compileS pull down menu or :. clicAing the shortcut icon on the left side of program window0 Load the program in program memor. of ,4P chip using the T5ile!load programS pull down menu0 Run the program and o:serve output using graph utilit.0

PR6?RA/ 56R I/PLE/E=TATI6= 65 55T I= T-S > /ain0c (fft (#*0c&> Vinclude Wmath0hX Vdefine PT4 *+ Vdefine PI '0"+"#E(*#'#3E2E ** ,epartment of E-E -/R Institute of Technolog. ))V of points for 55T

** ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

t.pedef struct Qfloat real1imag;R -6/PLEG;

void 55T(-6/PLEG 9@1 int n&; float io:ufferNPT4O; float <"NPT4O; short i; short :uffercount P ; short flag P ; -6/PLEG wNPT4O; -6/PLEG samplesNPT4O; main(& Q for (i P ; iWPT4 ; i88& Q

))55T protot.pe

))as input and output :uffer ))intermediate :uffer ))general purpose inde< varia:le ))num:er of new samples in io:uffer ))set to " :. I4R when io:uffer full ))twiddle constants stored in w ))primar. worAing :uffer

)) set up twiddle constants in w

wNiO0real P cos((9PI9i)(PT49(0 &&; ))Re component of twiddle constants wNiO0imag P!sin((9PI9i)(PT49(0 &&; ))Im component of twiddle constants R

for (i P ; i W PT4 ; i88& Q

))swap :uffers

io:ufferNiO P sin((9PI9" 9i)*+0 &;)9" ! X freM1 *+ !X sampling freM9) samplesNiO0realP 0 ; *2 ,epartment of E-E -/R Institute of Technolog.

*2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual samplesNiO0imagP 0 ; R

for (i P ; i W PT4 ; i88& Q

))swap :uffers

samplesNiO0realPio:ufferNiO; )):uffer with new data R for (i P ; i W PT4 ; i88& samplesNiO0imag P 0 ; 55T(samples1PT4&; for (i P ; i W PT4 ; i88& Q <"NiO P sMrt(samplesNiO0real9samplesNiO0real 8 samplesNiO0imag9samplesNiO0imag&; R R ))end of main ))imag components P ))call function 55T0c ))compute magnitude

EEt.,0
Vdefine PT4 *+ e<tern -6/PLEG wNPT4O; ))V of points for 55T ))twiddle constants stored in w t.pedef struct Qfloat real1imag;R -6/PLEG;

void 55T(-6/PLEG 9@1 int =& ))input sample arra.1 V of points *3 ,epartment of E-E -/R Institute of Technolog.

*3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual Q -6/PLEG temp"1temp(; int i1L1A; int leg`diff; int num`stages P ; int inde<1 step; i P "; do Q num`stages 8P"; i P i9(; Rwhile (iaP=&; leg`diff P =)(; step P (PT49(&)=; Q inde< P ; for (L P ; L W leg`diff; L88& Q for (upper`leg P L; upper`leg W =; upper`leg 8P ((9leg`diff&& Q lower`leg P upper`leg8leg`diff; temp"0real P (@Nupper`legO&0real 8 (@Nlower`legO&0real; temp"0imag P (@Nupper`legO&0imag 8 (@Nlower`legO&0imag; temp(0real P (@Nupper`legO&0real ! (@Nlower`legO&0real; temp(0imag P (@Nupper`legO&0imag ! (@Nlower`legO&0imag; *E ,epartment of E-E -/R Institute of Technolog. ))difference :etween upper$lower legs ))step :etween values in twiddle0h int upper`leg1 lower`leg; ))temporar. storage varia:les ))inde< of upper)lower :utterfl. leg ))num:er of 55T stages (iterations& ))inde<)step through twiddle constant ))log(:ase(& of = pointsP V of stages ))loop counter varia:les ))difference :etween upper)lower leg

for (i P ;i W num`stages; i88& ))for =!point 55T

*E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual (@Nlower`legO&0real P temp(0real9(wNinde<O&0real !temp(0imag9(wNinde<O&0imag; (@Nlower`legO&0imag P temp(0real9(wNinde<O&0imag 8temp(0imag9(wNinde<O&0real; (@Nupper`legO&0real P temp"0real; (@Nupper`legO&0imag P temp"0imag; R inde< 8P step; R leg`diff P leg`diff)(; step 9P (; R LP ; for (i P "; i W (=!"&; i88& Q A P =)(; while (A WP L& Q L P L ! A; A P A)(; R L P L 8 A; if (iWL& Q temp"0real P (@NLO&0real; temp"0imag P (@NLO&0imag; (@NLO&0real P (@NiO&0real; 2 ,epartment of E-E -/R Institute of Technolog. )):it reversal for reseMuencing data

2 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual (@NLO&0imag P (@NiO&0imag; (@NiO&0real P temp"0real; (@NiO&0imag P temp"0imag; R R return; R

RESULT0 In2ut0

Out2ut0 2" ,epartment of E-E -/R Institute of Technolog.

2" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

1UESTIONS
"0 What is the difference :etween radi< ( $ radi<+ 55T algorithms] (0 Wh. we need 55T]0 '0 What is the difference :etween decimation in time (,IT 55T& $ ,ecimation in freMuenc. (,I555T& algorithms] +0 What is meant :. Tin!placeS computation in ,I5 $ ,I5 algorithms] Which properties are used in 55T to re

2( ,epartment of E-E -/R Institute of Technolog.

2( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

FOR PRACTICE

Program 1.
(>:?>1BB28? 6:> +2851> C:89:+O72:8 28 =atlaG. x=[1,2]andh=[1,2,4] clc; clear all; close all; x=input('enter the 1st sequence'); h=input('enter the 2nd sequence'); y=conv(x,h); subplot ( ,1,1); ste!(x); ylabel ('a!plitude""#'); xlabel('(a) n ""#'); subplot ( ,1,2); ste!(h); ylabel ('a!plitude""#'); 2' ,epartment of E-E -/R Institute of Technolog.

2' ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual xlabel('(b) n ""#'); ste!(y); ylabel ('a!plitude""#'); xlabel ('(c) n ""#'); $disp('the resultant si%nal is');y

Program 2.
PRO$RAMMIN$ FOR CIRCULAR CON3OLUTION IN /atlab0 clc; clear all; close all; gPinput(Kenter the "st seMuenceK&; hPinput(Kenter the (nd seMuenceK&; n"Plength(g&; n(Plength(h&; nPma<(n"1n(&; n'Pn"!n(; Zloop for getting eMual length seMuence if(n"Xn(&; hPNh17eros("1n'&O; 2+ ,epartment of E-E

-/R Institute of Technolog.

2+ ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual else gPNg17eros("1!n'&O; end Z computation of circular convolved seMuence for iP">n; .(i&P ; APi; for LP">n; .(i&P.(i&8g(L&9h(A&; APA!"; if(APP & APn; end end end .la:el(Kamplitude!!XK&; <la:el(K.(n&!!XK&; su:plot((1(1"&; stem(.&; title(Kcircular convolutionK&; disp(Kthe result at signal in <K&;.

Program 3.
&UTTERSORTH IIR DI$ITAL LOS PASS FILTER0
I2ro.ra/ Eor butt)r +ort7 IIR 8*.*tal LPF +2K*n2utBU)nt)r 2a99 ban8 ,utoEE Er)Gu)n,y0UCA +9K*n2utBU)nt)r 9to2 ban8 ,utoEE Er)Gu)n,y0UCA 2# ,epartment of E-E -/R Institute of Technolog.

2# ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual r2K*n2utBU)nt)r 2a99 ban8 r*22l) *n 8bUCA r9K*n2utBU)nt)r 9to2 ban8 r*22l) *n 8bUCA E9K*n2utBU)nt)r t7) 9a/2l*n. Er)Gu)n,yUCA +1K O+2NE9A + K O+9NE9A ?n=+n@Kbuttor8B+1=+ =r2=r9=U9UCA I?P=2=-@Kbutt)rBn=+nCA I?b=a@KP2 tEBP=2=-CA ?b=a@Kbutt)rBn=+n=U9UC ?b1=a1@K*/2*n(arBb=aCA +K!0!.!102*A ?7=o/@KEr)GPBb1=a1=+CA /K !Olo.1!Bab9B7CCA anKan.l)B7CA 9ub2lotB =1=1CA 2lotBo/N2*=/CA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA 2lotBo/N2*=anCA >lab)lBUnor/al*P)8 Er)Gu)n,y----<UCA ylab)lBU27a9) *n ra8*an9----<UCA

RESULT0

2* ,epartment of E-E -/R Institute of Technolog.

2* ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

)nt)r 2a99 ban8 ,utoEE Er)Gu)n,y01%!! )nt)r 9to2 ban8 ,utoEE Er)Gu)n,y03!!! )nt)r 2a99 ban8 r*22l) *n 8b1! )nt)r 9to2 ban8 r*22l) *n 8bR! )nt)r t7) 9a/2l*n. Er)G)n,y#!!!

bK aK

! 1.!!!!

! 1.%3#

! 1.1T1%

! !.%#%#

!.!!R! !.!3T% !.!!R!

!.1T#!

22 ,epartment of E-E -/R Institute of Technolog.

22 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

Pro.ra/ R.

&UTTERSORTH IIR DI$ITALHI$H PASS FILTER 0


IPro.ra/ Eor 8*.*tal IIR HPF +2K*n2utBU)nt)r 2a99 ban8 )8.) Er)GUCA +9K*n2utBU)nt)r 9to2 ban8 )8.) Er)GUCA r2K*n2utBU)nt)r 2a99ban8 r*22l)UCA r9K*n2utBU)nt)r 9to2ban8 r*22l)UCA ?N=+n@Kbuttor8B+2=+9=r2=r9CA ?b=a@Kbutt)rBN=+n=U7*.7UCA ?7=o/).a@KEr)GPBb=aCA .a*nK !Olo.1!Bab9B7CCA anKan.l)B7CA 9ub2lotB =1=1CA 2lotBo/).aN2*=.a*nCA t*tl)BU/a. r)9 oE 8*.*tal 72EUCA >lab)lBUnor/al*P)8 Er)G-----<UCA 23 ,epartment of E-E -/R Institute of Technolog.

23 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual ylab)lBU.a*n *n 8b-----<UC 9ub2lotB =1= CA 2lotBo/).aN2*=anCA t*tl)BU27a9) r)9 oE 8*.*tal 72EUCA >lab)lBUnor/al*P)8 Er)G-------<UCA ylab)lBUan.l)----<UCA

RESULT0-

)nt)r 2a99 ban8 )8.) Er)G .% 2E ,epartment of E-E -/R Institute of Technolog.

2E ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual )nt)r 9to2 ban8 )8.) Er)G .T )nt)r 2a99 ban8 r*22l) 1! )nt)r 9to2 ban8 r*22l) R! bK !.!VV

-!.3V"#

!.%V%! -!.3V"#

!.!VV

aK 1.!!!! -!.!"#R

!.RT#% -!.!1R1

!.!1#T

Pro.ra/ %.

FIR LOS PASS FILTER DESI$N USIN$ HAMMIN$ SINDOS0

I2ro.ra/ Eor FIR LPF u9*n. Ha//*n. +*n8o+ 3 ,epartment of E-E -/R Institute of Technolog.

3 ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual nK !A E2K !!A EGK3!!A E9K1!!!A EnK OE2NE9A +*n8o+K7a//*n.BnL1CA bKE*r1Bn=En=+*n8o+CA ?H S@KEr)GPBb=1=1 TCA 9ub2lotB =1=1CA 2lotBSN2*=ab9BHCCA t*tl)BU/a.n*tu8) r)92on9) oE l2EUCA ylab)lBU.a*n *n 8b--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA 9ub2lotB =1= CA 2lotBSN2*=an.l)BHCCA t*tl)BU27a9) r)92on9) oE l2EUCA ylab)lBUan.l)--------<UCA >lab)lBUnor/al*P)8 Er)Gu)n,y------<UCA

3" ,epartment of E-E -/R Institute of Technolog.

3" ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual

RESULT0-

+*n8o+ K -!.!!!! !.!!V !.!R! !.1!1R !. !!T !.3R!! !.%!VT !."TV !.TRV !.V"! 1.!!!! !.V"! !.TRV !."TV !.%!VT !.3R!! !. !!T !.1!1R !.!R! !.!!V -!.!!!! bK !.!!!! -!.!!!3 -!.!!!V -!.!!!! -!.!3T" -!.!R3! !.3VVV ,epartment of E-E !. V!" !.!! # !.!#VR !.!1!1 !. V!"

!.!#VR -!.!R3! -!.!3T" 3( -/R Institute of Technolog.

3( ,epartment of E-E -/R Institute of Technolog.

DSP Laboratory Manual DSP Laboratory Manual -!.!!!! !.!1!1 !.!!!! !.!! # -!.!!!V -!.!!!3

3' ,epartment of E-E -/R Institute of Technolog.

3' ,epartment of E-E -/R Institute of Technolog.

Das könnte Ihnen auch gefallen