Professional Documents
Culture Documents
Course : B.Tech. (ECE) Year Se!es"er:III #I Sess$o%: &''()'* D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
L T P
Sampling & Waveform Generation. Quantization PCM Encoding !elta Modulation !igital Modulation Sc#eme$ %&S'( PS'( )S'* Error Correcting Code$ !)- Computation. )a$t )ourier -ran$form. )01 )ilter implementation. 001 )ilter implementation. !SP Proce$$or 0mplementation Computational E3periment$ 4it# !igital )ilter$
L$s" o2 E3u$4!e%" 2or D$+$"a, S$+%a, Process$%+ La- (TEC)./&) Fu%c"$o%a, S"a"us 5"6(N os.) 7or8$%+ No%)7or8$%+ 9' 9' NIL 9' 9' 9/ 9/ & & / 9' 9' 9/ 9/ & & / NIL NIL NIL NIL NIL NIL NIL
S.No. 1 2 3
E3u$4!e%" -MS322C+,13 !S' development 5oard E3ternal "6!C po4er $uppl7 0EEE 12. compliant male8 to8female ca5le 233M9z or 9ig#er Pentium8 Compati5le CP: Monitor )re;uenc7 Generator C1< Spea=er >ac=
" + , .
S.No.
I"e!s
5ua%"$"6 (Nos.)
Course : B.Tech. (ECE) Year Se!es"er:III #I Sec"$o%:C9 C& L$s" o2 S"u:e%"s o2 EC #I Se!es"er 2or "he Sess$o% &''()'*
S.No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Roll No. Group C1 Name
36 37 38 39 Group C2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
printf%KLne3ponential $ignal %Enter *K*I EEe3ponential $ignal $canf%KMdK(&c#oice*I i D + 2I EE+ 2 $ample$ of t#e $ignal 4ill 5e generated & D 1.2I EEma3imum amplitude of t#e $ignal$ i$ 1 $4itc#%c#oice* J ca$e 1 N for%n D 2I n G iI nOO* EE co$ine 4ave 3BnC D & P co$% 2 P 3.1 1"/2, P ) P %nE)$**I 5rea=I ca$e 2 N for%n D 2I n G iI nOO* EE $ine 4ave 3BnC D & P $in% 2 P 3.1 1"/2, P ) P %nE)$**I 5rea=I ca$e 3 N = D 2I EE $;uare 4ave do J for% n D %=P)$*E%2P)*I n G %%=O1*P)$*E%2P)*I nOO* J EE po$itive #alf c7cle of a;uare 4ave 3BnC D &I if%nHi*5rea=I Q for%n D %%=O1*P)$*E%2P)*I n G %%=O2*P)$*E%2P)*I nOO* J EE negative #alf c7cle of a;uare 4ave 3BnC D 8&I if%nHi* 5rea=I Q = D =O2I EE t#i$ count i$ modified for ne3t c7cle Q 4#ile%nGi*I 5rea=I ca$e N for%n D 2I n G iI nOO* EE e3ponential $ignal 3BnC D & P e3p% 8%nE)$**I 5rea=I Q Q For Sa!4,$%+: Finclude K$amplecfg.#K Finclude KCNLCCStudioRv3.1LC+222Ld$=+,13LincludeLd$=+,13.#K Finclude KCNLCCStudioRv3.1LC+222Ld$=+,13LincludeLd$=+,13Raic23.#K Fdefine S 33 $#ort antialia$ingRfilter%$#ortP($#ortP*I $#ort recon$tructionRfilter%$#ortP($#ortP*I int flagD2(antialia$ingD2(reconD2I
$#ort #B33CDJ831( 3(+/(8".(81,.( 2(3,/(.1(8+,2(8 2+(122+( 11,2(8132+(82.",(1"" (1222+(1 ,3/(1222+(1"" (82.",( 8132+(11,2(122+(8 2+(8+,2(.1(3,/( 2(81,.(8".(+/( 3(831QI $#ort inpR5ufferBSC(outR5ufferBSC(antRoutBSC(outR$ampleI $#ort leftRoutput(rig#tRoutput(lRinput(rRinput(i(flag2D2(flgD2I !S'+,13R&0C23RConfig config D J L 23221,( EP 2 !S'+,13R&0C23RAE)-0S6<A Aeft line input c#annel volume PE L 23221,( EP 1 !S'+,13R&0C23R10G9-0S6<A 1ig#t line input c#annel volume PEL 2322d.( EP 2 !S'+,13R&0C23RAE)-9P6<A Aeft c#annel #eadp#one volume PE L 2322d.( EP 3 !S'+,13R&0C23R10G9-9P6<A 1ig#t c#annel #eadp#one volume PE L 232211( EP !S'+,13R&0C23R&S&P&-9 &nalog audio pat# control PE L 232222( EP " !S'+,13R&0C23R!0GP&-9 !igital audio pat# control PE L 232222( EP + !S'+,13R&0C23RP<WE1!<WS Po4er do4n control PE L 2322 3( EP , !S'+,13R&0C23R!0G0) !igital audio interface format PE L 2322.1( EP . !S'+,13R&0C23RS&MPAE1&-E Sample rate control PE L 232221 EP / !S'+,13R&0C23R!0G&C- !igital interface activation PE L QI void main%* J !S'+,13R&0C23RCodec9andle #CodecI :int32 lRinput( rRinput(lRoutput( rRoutputI EP 0nitialize t#e 5oard $upport li5rar7( mu$t 5e called fir$t PE !S'+,13Rinit%*I EP Start t#e codec PE #Codec D !S'+,13R&0C23RopenCodec%2( &config*I !S'+,13R&0C23R$et)re;%#Codec( 3*I 4#ile%1* J EP 1ead a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &lRinput**I EP 1ead a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &rRinput**I EPPPPPPPproce$$ingPPPPPPPPE inpR5ufferB2CDrRinputI
outR$ampleD2I if%flgDD2* flgD1I el$e J if%antialia$ingDD1* outR$ampleDantialia$ingRfilter%inpR5uffer(#*I el$e outR$ampleDrRinputI flgD2I Q for%iDS81IiH2Ii88* inpR5ufferBiCDinpR5ufferBi81CI outR5ufferB2CDoutR$ampleI if%reconDD1* outR$ampleDrecon$tructionRfilter%outR5uffer(#*I for%iDS81IiH2Ii88* outR5ufferBiCDoutR5ufferBi81CI lRoutputDoutR$ampleI rRoutputDoutR$ampleI EP Send a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( lRoutput**I EP Send a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( rRoutput**I Q EP Clo$e t#e codec PE !S'+,13R&0C23Rclo$eCodec%#Codec*I Q $#ort antialia$ingRfilter%$#ort P3($#ort P#* J $#ort @(valI long int $umD2I for%@D2I@GSI@OO* $um OD %long int*3B@CP%long int*#B@CI $umD$umHH1"I valD%$#ort*$umI return%val*I Q
$#ort recon$tructionRfilter%$#ort P3($#ort P#* J $#ort @(valI long int $umD2I for%@D2I@GSI@OO* $um OD %long int*3B@CP%long int*#B@CI $umD$umHH1"I valD%$#ort*$umI return%val*I Q Me"ho: o2 E;4er$!e%": For =a>e2or! +e%era"$o%: <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name =a>e2or!.4<". Create t#e $ource file i.e. program for 4aveform generation in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%37z.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. For sa!4,$%+ o2 =a>e2or!: Connect C1< to t#e Soc=et Provided for A0SE <:-. Connect a Signal Generator to t#e A0SE 0S Soc=et. S4itc# on t#e Signal Generator 4it# a $ine 4ave of fre;uenc7 "22 9z. and 6p8 pD1."v. So4 S4itc# on t#e !S' and ?ring :p Code Compo$er Studio on t#e PC. Create a ne4 pro@ect 4it# name sa!4,e.4<". )rom t#e )ile Menu W ne4 W !SPE?0<S Configuration W$elect Xd$=+,13.cd5Y and $ave it a$ Bsa!4,e.c:-C &dd Bsa!4,e.c:-C to t#e current pro@ect. &dd t#e given Bco:ec.cC file to t#e current pro@ect 4#ic# #a$ t#e main function and call$ all t#e ot#er nece$$ar7 routine$. &dd t#e li5rar7 file B:s8.A9D-s,.,$-C to t#e current pro@ect
Pa"h W XCNLCCStudioLC+222Ld$=+,13Lli5Ld$=+,135$l.li5Y Cop7 file$ B:s8.A9D.hC and B:s8.A9DEa$c&D.hC from CNLCCStudioLC+222Ld$=+,13Linclude and pa$te it in current pro@ect. ?uild( Aoad and 1un t#e program. Zou can notice t#e input $ignal of "22 9z. appearing on t#e C1< verif7ing t#e codec configuration. Zou can al$o pa$$ an audio input and #ear t#e output $ignal t#roug# t#e $pea=er$. Zou can al$o var7 t#e $ampling fre;uenc7 u$ing t#e !S'+,13R&0C23R$et)re; )unction in t#e Bco:ec.cC file and repeat t#e a5ove $tep$. Resu,":-#e output 4aveform can 5e $een on t#e monitor and $ampling can 5e vie4ed on C1< after performing t#e e3periment. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: Student$ #ave no4 under$tood t#e 5a$ic concept of $ampling and #o4 an7 4aveform i$ generated and $ampled.
F$+ure 9: Sa!4,$%+ a%: 3ua%"$Fa"$o% o2 a% a%a,o+ s$+%a, -#e appro3imation introduced 57 ;uantization manife$t$ it$elf a$ a noi$e( called !uanti"ation noise. <ften( for t#e anal7$i$ of $ound8proce$$ing circuit$( $uc# noi$e i$ a$$umed to 5e 4#ite and
de8correlated 4it# t#e $ignal( 5ut in realit7 it i$ perceptuall7 tied to t#e $ignal it$elf( in $uc# an e3tent t#at ;uantization can 5e perceived a$ an effect. Co:e: Finclude K;uancfg.#K Finclude KENLcc$tudioRv3.1Lc+222Ld$=+,13LincludeLd$=+,13.#K Finclude KENLcc$tudioRv3.1Lc+222Ld$=+,13LincludeLd$=+,13Raic23.#K EEe3tern $igned int )0A-E1%$igned int *I !S'+,13R&0C23RConfig config D J L 23221,( EP 2 !S'+,13R&0C23RAE)-0S6<A Aeft line input c#annel volume PE L 23221,( EP 1 !S'+,13R&0C23R10G9-0S6<A 1ig#t line input c#annel volume PEL 2322d.( EP 2 !S'+,13R&0C23RAE)-9P6<A Aeft c#annel #eadp#one volume PE L 2322d.( EP 3 !S'+,13R&0C23R10G9-9P6<A 1ig#t c#annel #eadp#one volume PE L 232211( EP !S'+,13R&0C23R&S&P&-9 &nalog audio pat# control PE L 232222( EP " !S'+,13R&0C23R!0GP&-9 !igital audio pat# control PE L 232222( EP + !S'+,13R&0C23RP<WE1!<WS Po4er do4n control PE L 2322 3( EP , !S'+,13R&0C23R!0G0) !igital audio interface format PE L 2322.1( EP . !S'+,13R&0C23RS&MPAE1&-E Sample rate control PE L 232221 EP / !S'+,13R&0C23R!0G&C- !igital interface activation PE L QI EP P main%* 8 Main code routine( initialize$ ?SA and generate$ tone PE :int32 lRinput( rRinput(lRoutput( rRoutputI void main%* J !S'+,13R&0C23RCodec9andle #CodecI
EP 0nitialize t#e 5oard $upport li5rar7( mu$t 5e called fir$t PE !S'+,13Rinit%*I EP Start t#e codec PE #Codec D !S'+,13R&0C23RopenCodec%2( &config*I !S'+,13R&0C23R$et)re;%#Codec( 3*I 4#ile%1* J EP 1ead a $ample to t#e left c#annel PE
4#ile %T!S'+,13R&0C23Rread%#Codec( &lRinput**I EP 1ead a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &rRinput**I lRoutputD ;uan%lRinput*I rRoutputD lRoutputI EP Send a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( lRoutput**I EP Send a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( rRoutput**I Q EP Clo$e t#e codec PE !S'+,13R&0C23Rclo$eCodec%#Codec*I Q int ;uan%:int32 $inRout* J float $inRpo$B122C($inRnegB122C(po$RoutB122C(negRoutB122CI float ;uantRoutB122CI int iI for%iD2IiG122IiOO* J $inRpo$BiC D $inRout I $inRnegBiC D $inRout I if %$inRpo$BiC G 1* J po$RoutBiC D 2I Q el$e if %$inRpo$BiC G 3* J po$RoutBiC D 2I Q el$e if %$inRpo$BiC G "* J po$RoutBiC D I Q el$e if %$inRpo$BiC G ,* J po$RoutBiC D+I Q
el$e if %$inRpo$BiC G /* J po$RoutBiC D .I Q el$e if %$inRpo$BiC G 12* J po$RoutBiC D 12I Q el$e J po$RoutBiC D 2I Q if % $inRnegBiC H 81* J negRoutBiC D 81 I Q el$e if % $inRnegBiC H 83* J negRoutBiC D 82I Q el$e if % $inRnegBiC H 8"* J negRoutBiC D 8 I Q el$e if % $inRnegBiC H 8,* J negRoutBiC D8+I Q el$e if % $inRnegBiC H 8/* J negRoutBiC D 8.I Q el$e if % $inRnegBiC H 812* J negRoutBiC D 812I Q el$e J negRoutBiC D 2I Q ;uantRoutBiC D po$RoutBiC O negRoutBiCI Q Q
Me"ho: o2 E;4er$!e%": Connect C1< to t#e Soc=et Provided for A0SE <:-. Connect a Signal Generator to t#e A0SE 0S Soc=et. S4itc# on t#e Signal Generator 4it# a $ine 4ave of fre;uenc7 "22 9z. and 6p8 pD1."v. So4 S4itc# on t#e !S' and ?ring :p Code Compo$er Studio on t#e PC. Create a ne4 pro@ect 4it# name 3ua%".4<". )rom t#e )ile Menu W ne4 W !SPE?0<S Configuration W$elect Xd$=+,13.cd5Y and $ave it a$ B3ua%".c:-C &dd B3ua%".c:-C to t#e current pro@ect. &dd t#e given Bco:ec.cC file to t#e current pro@ect 4#ic# #a$ t#e main function and call$ all t#e ot#er nece$$ar7 routine$. &dd t#e li5rar7 file B:s8.A9D-s,.,$-C to t#e current pro@ect Pa"h W XCNLCCStudioLC+222Ld$=+,13Lli5Ld$=+,135$l.li5Y Cop7 file$ B:s8.A9D.hC and B:s8.A9DEa$c&D.hC from CNLCCStudioLC+222Ld$=+,13Linclude and pa$te it in current pro@ect. ?uild( Aoad and 1un t#e program. Zou can notice t#e input $ignal of "22 9z. appearing on t#e C1< verif7ing t#e codec configuration. Zou can al$o pa$$ an audio input and #ear t#e output $ignal t#roug# t#e $pea=er$. Zou can al$o var7 t#e $ampling fre;uenc7 u$ing t#e !S'+,13R&0C23R$et)re; )unction in t#e Bco:ec.cC file and repeat t#e a5ove $tep$. Resu,": Quantized 4aveform o5tained on C1<. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: Student$ #ave no4 under$tood t#e 5a$ic concept of ;uantization and it$ real application in digital $ignal proce$$ing.
Co:e: Finclude G$tdio.#H Finclude G$tdli5.#H Finclude Gmat#.#H dou5le ;uantize%dou5le value(dou5le delta* J int ; D valueEdeltaI if %%value8deltaP;*GD%delta P %; O 1*8value** return delta P ;I el$e return delta P %; O 1*I Q void ;uantizeRvector%dou5le $BC(dou5le 3BC(dou5le dit#erBC(dou5le delta(int n* J int iI for %iD2IiGnIiOO* $BiC D ;uantize%3BiCOdit#erBiC(delta*8dit#erBiCI Q void printRvector%dou5le 3BC(int n* J int iI for %iD2IiGnIiOO* printf%KM.2fK(3BiC*I printf%KLnK*I Q void printR5it$%c#ar 3BC(int n* J int iI for %i D 2I i G nI iOO* printf%KMcK( 3BiC \ [1[ N [2[*I printf%KLnK*I Q dou5le $;r%dou5le 3* J return 3 P 3I Q dou5le di$tance%dou5le 7BC(dou5le dit#erBC(dou5le delta(int n* J int iI dou5le $umD2.2I for %iD2IiGnIiOO* $um OD$;r%7BiC8%;uantize%7BiCOdit#erBiC(delta*8dit#erBiC**I return $umI Q int decodeRvector%dou5le 7BC(dou5le PPdit#er(dou5le delta(int l* J
return %di$tance%7(dit#erB2C(delta(l* G di$tance%7(dit#erB1C(delta(l** \ 2 N 1I Q int main%int argc(c#ar PargvBC* J dou5le P$(P3(P7I dou5le delta(delta2I dou5le PPdit#erI int nI int iI int n5it$I c#ar P5it$( P5it$2I int lI $rand%123 *I deltaD12.2I delta2DdeltaE2.2I n5it$D12222I 5it$Dmalloc%n5it$P$izeof%c#ar**I 5it$2Dmalloc%n5it$ P $izeof%c#ar**I for %iD2IiGn5it$IiOO* J 5it$BiCD%rand%* H 1&S!RM&] E 2* \ 2 N 1I 5it$2BiCD2I Q printf%Koriginal 5it$LnK*I printR5it$%5it$( n5it$*I l D 1 2I dit#er D malloc%2 P $izeof%dou5le P**I dit#erB2C D malloc%l P $izeof%dou5le**I dit#erB1C D malloc%l P $izeof%dou5le**I for %i D 2I i G lI iOO* J dit#erB2CBiC D %rand%* E %dou5le* 1&S!RM&]* P delta 8 delta2I if %dit#erB2CBiC G 2.2* dit#erB1CBiC D dit#erB2CBiC O delta2I el$e dit#erB1CBiC D dit#erB2CBiC 8 delta2I Q printf%Kdit#er 2LnK*I printRvector%dit#erB2C( l*I printf%Kdit#er 1LnK*I printRvector%dit#erB1C( l*I n D l P n5it$I $ D malloc%n P $izeof%dou5le**I 3 D malloc%n P $izeof%dou5le**I 7 D malloc%n P $izeof%dou5le**I for %i D 2I i G nI iOO* J
3BiC D %rand%* E %dou5le* 1&S!RM&]* P 2"".2I $BiC D 2.2I 7BiC D 2.2I Q printf%KoriginalLnK*I printRvector%3( n*I for %i D 2I i G n5it$I iOO* J int 5it D 5it$BiCI ;uantizeRvector%$ O lPi( 3 O lPi( dit#erB5itC( delta( l*I Q printf%K4atermar=edLnK*I printRvector%$( n*I for %i D 2I i G nI iOO* J 7BiC D $BiC O " P %%rand%* E %dou5le* 1&S!RM&]* 8 2."*I Q printf%Kattac=edLnK*I printRvector%7( n*I for %iD2IiGnIiOO* J if %iH222 && iG322* 7BiC D 2I Q printf%KzeroedLnK*I printRvector%7( n*I for %i D 2I i G n5it$I iOO* J 5it$2BiC D decodeRvector%7 O lPi( dit#er( delta( l*I Q printf%Kdecoded 5it$LnK*I printR5it$%5it$2( n5it$*I for %iD2IiGn5it$IiOO* if %5it$BiC TD 5it$2BiC* printf%Kerror 5it FMdLnK( i*I e3it%2*I Q Me"ho: o2 E;4er$!e%"N <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name 4c!.4<". Create t#e $ource file i.e. program for XpcmY in C language.
&dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%pcm.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. Resu,": -#e encoded data can 5e $een on t#e monitor and inference$ 4ill 5e dra4n from t#at. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: Student$ #ave no4 came to =no4n t#e different t7pe$ of encoding u$ed for ;uantized $ignal and tgeir tran$mi$$ion.
-#e modulator i$ made 57 a ;uantizer 4#ic# convert$ t#e difference 5et4een t#e input $ignal and t#e average of t#e previou$ $tep$. 0n it$ $imple$t form( t#e ;uantizer can 5e realized 4it# a comparator referenced to 2 %t4o level$ ;uantizer*( 4#o$e output i$ 1 or 0 if t#e input $ignal i$ po$itive or negative. -#e demodulator i$ $impl7 an integrator %li=e t#e one in t#e feed5ac= loop* 4#o$e output ri$e$ or fall$ 4it# eac# 1 or 2 received. -#e integrator it$elf con$titute$ a lo48pa$$ filter. Co:e: EP)cD32#z )mD12#z Carrier GainD12 Modulation 0nde3 D3IPE FincludeG$tdio.#H FincludeGmat#.#H float ]1B"2C(]2B"2C(]3B"2CI main%* J int i(@(=(fc(Gain(fmI float ?etaI printf% K Enter t#e value of Carrier fre;uenc7 LnK*I $canf%KMdK(&fc*I printf%K enter t#e value of GainLnK*I $canf%KMdK(&Gain*I printf%KEnter t#e value of modulation )re;uenc7LnK*I $canf%KMdK(&fm*I printf%KEnter t#e value of Modulation inde3LnK*I $canf%KMfK(&?eta*I printf%Kcarrier $ignal LnK*I for%iD2IiGD"2IiOO* J ]1BiCD GainPco$%2P3.1 PfcPiE122*I printf%KMf LtK( ]1BiC*I Q printf%KLn Ln $inu$oidal SignalLnLnK*I for%@D2I@GD"2I@OO* J ]2B@CD ?etaP$in%2P3.1 PfmP@E122*I printf%KMfLt K(]2B@C*I Q
printf%KLn Ln )re;uenc7 Modulated SignalLnLnK*I for%=D2I=GD"2I=OO* J ]3B=CD]1BiCPco$%%2P3.1 PfcP=E122* O?etaP$in%2P3.1 PfmP=E122**I printf%KMf LtK(]3B=C*I QQ Me"ho: o2 E;4er$!e%": <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name :e,"a.4<". Create t#e $ource file i.e. program for delta modulation in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%37z.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. Resu,": -#e delta modulated $ignal can 5e $een on t#e monitor for nece$$ar7 parameter$ calculation to 5e =no4n. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es:!elta modulated $ignal advantage$ in !SP application under$tood from t#i$ practical and al$o it$ practical application$.
0n Q&M( an inp#a$e $ignal %t#e 0 $ignal( for e3ample a co$ine 4aveform* and a ;uadrature p#a$e $ignal %t#e Q $ignal( for e3ample a $ine 4ave* are amplitude modulated 4it# a finite num5er of amplitude$( and $ummed. 0t can 5e $een a$ a t4o8c#annel $7$tem( eac# c#annel u$ing &S'. -#e re$ulting $ignal i$ e;uivalent to a com5ination of PS' and &S'. 0n all of t#e a5ove met#od$( eac# of t#e$e p#a$e$( fre;uencie$ or amplitude$ are a$$igned a uni;ue pattern of 5inar7 5it$. :$uall7( eac# p#a$e( fre;uenc7 or amplitude encode$ an e;ual num5er of 5it$. -#i$ num5er of 5it$ compri$e$ t#e s#m ol t#at i$ repre$ented 57 t#e particular p#a$e. 0f t#e alp#a5et con$i$t$ of $ D 2% alternative $7m5ol$( eac# $7m5ol repre$ent$ a me$$age con$i$ting of % 5it$. 0f t#e $7m5ol rate %al$o =no4n a$ t#e 5aud rate* i$ f& $7m5ol$E$econd %or 5aud*( t#e data rate i$ %f& 5itE$econd.
)or e3ample( 4it# an alp#a5et con$i$ting of 1+ alternative $7m5ol$( eac# $7m5ol repre$ent$ 5it$. -#u$( t#e data rate i$ four time$ t#e 5aud rate. 0n t#e ca$e of PS'( &S' or Q&M( 4#ere t#e carrier fre;uenc7 of t#e modulated $ignal i$ con$tant( t#e modulation alp#a5et i$ often convenientl7 repre$ented on a con$tellation diagram( $#o4ing t#e amplitude of t#e 0 $ignal at t#e 38a3i$( and t#e amplitude of t#e Q $ignal at t#e 78 a3i$( for eac# $7m5ol. Co:e: Co:e 2or ASH FincludeG$tdio.#H FincludeG$tring.#H FincludeGmat#.#H void fre;R12% void *I void fre;R2% void *I float cB1222CI int =D2I main%* J int i( lengt#I c#ar 5B12CI put$%KLn Enter t#e value for &S' in 1[$ and 2[$LnK*I get$%5*I lengt# D $trlen%5*I for%iD2IiGlengt#IiOO* J if %5BiCDD[1[* fre;R12%*I el$e fre;R2%*I Q Q void fre;R12 %* J int @I for%@D=I@G%=O122*I@OO* J cB@CD $in%2P3.1 P12P@E222*I printf%KLnMd@LtMd@LtLtM.3fcLnK(@(=(cB@C*I Q =D@I Q void fre;R2 %* J int @I for%@D=I@G%=O122*I@OO*
J cB@CD 2I printf%KLnMdLt MdLtLtM.3fLnK(@(=(cB@C*I Q =D@I Q Co:e 2or FSH FincludeG$tdio.#H FincludeG$tring.#H FincludeGmat#.#H void fre;R12% void *I void fre;R"% void *I float cB1222CI int =D2I main%* J int i( lengt#I c#ar 5B12CI put$%KLn Enter t#e value for )S' in 1[$ and 2[$LnK*I get$%5*I lengt# D $trlen%5*I for%iD2IiGlengt#IiOO* J if %5BiCDD[1[* fre;R12%*I el$e fre;R"%*I Q Q void fre;R12 %* J int @I for%@D=I@G%=O122*I@OO* J cB@CD $in%2P3.1 P12P@E"22*I printf%KLnMdLtMdLtLtM.3fLnK(@(=(cB@C*I Q =D@I Q void fre;R" %* J int @I for%@D=I@G%=O122*I@OO* J
cB@CD $in%2P3.1 P"P@E"22*I printf%KLnMdLt MdLtLtM.3fLnK(@(=(cB@C*I Q =D@I Q Me"ho: o2 E;4er$!e%": <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name !o:E"ech.4<". Create t#e $ource file i.e. program for an7 modulation tec#ni;ue %&S'( )S'* in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%37z.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. Resu,": Waveform$ for &S' and )S' are $#o4n on C1<. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: Student 4ill came to =no4 t#e advantage$ of different digital modulation $c#eme$ and t#eir $ignal8to8noi$e performance
Sote t#at 2x 5ecome$ zero in t#e a5ove e;uation 5ecau$e addition of coefficient$ i$ performed modulo 2
Multiplication i$ $imilarN
We can al$o divide pol7nomial$ mod 2 and find t#e ;uotient and remainder. )or e3ample( $uppo$e 4e[re dividing x3 O x2 O x 57 x O 1. We 4ould find t#at
Co:e: EP !ESC10P-0<S P P Program for t#e error detection P P u$ing t#e -MS322C+,13 !S'. P P P P
P P P Enter t#e data in t#e form of $tring P P P P input 88H 0nput data $tring P P data 88H <utput data $tring PE EPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPE FincludeG$tdio.#H FincludeG$tring.#H int i(frameRlengt#(pol7nomialRdegree(dividendB122C(remainderB122CI int tempRvar1D2(dataB122CI void main%* J c#ar inputB122CI int pol7nomialB12C(frameRpointerD2(tempRvarD2(remainderRlengt#D2I EPPPPPPPPPPPPPPPP0nput data $tringPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPE printf%K Enter t#e !ata B?it$ $tringCNNK*I get$%input*I frameRlengt#D$trlen%input*81I for%iD2IiG$trlen%input*IiOO* J if%inputBiCDD[1[* dataBiCD1I el$e dataBiCD2I Q EEEnter in t#e form of 5it $tring
EPPPPPPPPPPPPEnter t#e Pol7nomial or divi$or $tring PPPPPPPPPPPPPPPPPPPPPPPPPPE printf%KEnter t#e C1C Pol7nomialEdivi$orNNK*I EEEnter t#e pol7nomial or divi$or $tring get$%input*I pol7nomialRdegreeD$trlen%input*81I for%iD2IiG$trlen%input*IiOO* J if%inputBiCDD[1[* pol7nomialBiCD1I el$e pol7nomialBiCD2I Q EPPPPPPPPPPPP)or C7clic 1edundanc7 c#ec=PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPE for%iDframeRlengt#O1IiGDframeRlengt#Opol7nomialRdegreeIiOO* dataBiCD2I for%iD2IiGDpol7nomialRdegreeIiOO* dividendBiCDdataBiCI frameRpointerDpol7nomialRdegreeO1I remainderRlengt#Dpol7nomialRdegreeI 4#ile%remainderRlengt#DDpol7nomialRdegree*
J for%iD2IiGDpol7nomialRdegreeIiOO* J if%dividendBiCDDpol7nomialBiC* remainderBiCD2I el$e remainderBiCD1I Q for%tempRvarD81(iD2IiGDpol7nomialRdegreeIiOO* J if%remainderBiCDD1 __ tempRvarH81* dividendBOOtempRvarCDremainderBiCI Q if%tempRvarGpol7nomialRdegree* J if%frameRpointerGD%pol7nomialRdegreeOframeRlengt#** J tempRvar1DtempRvarI for%iD2IiG%pol7nomialRdegree8tempRvar1*IiOO* J if%frameRpointerGD%pol7nomialRdegreeOframeRlengt#** dividendBOOtempRvarCDdataBframeRpointerOOCI el$e J remainderRlengt#DtempRvarI 5rea=I Q Q Q el$e remainderRlengt#DtempRvarI Q Q if%remainderRlengt#DD81* for%iD1IiGDpol7nomialRdegreeIiOO* dataBframeRlengt#OiCD2I el$e J for%iD%pol7nomialRdegree8remainderRlengt#*IiH1Ii88* dataBOOframeRlengt#CD2I for%iD2IiGDremainderRlengt#IiOO* dataBOOframeRlengt#CDdividendBiCI Q printf%KGTT -#e C1C $tatu$ TT HK*I for%iD2IiGDframeRlengt#IiOO* printf%KMdK(dataBiC*I Q Me"ho: o2 E;4er$!e%":
<pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name crc.4<". Create t#e $ource file i.e. program for Xerror correctionY in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%crc.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. Resu,": -o verif7 t#e C1C $tatu$( <5$erve t#e output $tring( vie4 t#e output 4indo4 in t#e CCS 0!E. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: -#e $tudent came to =no4 t#at #o4 t#e error correcting code$ are #elpful in tran$mi$$ion of an7 digital data
Co:e: Finclude G$tdio.#H Finclude Gmat#.#H void dft%$#ort P3( $#ort =( int Pout*I EEfunction protot7pe Fdefine S . EEnum5er of data value$ float pi D 3.1 1+I $#ort 3BSC D J1222(,2,(2(8,2,(81222(8,2,(2(,2,QI EE18c7cle co$ine EE$#ort 3BSCDJ2(+22(/, (/, (+22(2(8+22(8/, (8/, (8+22(
EE 2(+22(/, (/, (+22(2(8+22(8/, (8/, (8+22QIEE28c7cle$ $ine int outB2C D J2(2QI EEinit 1e and 0m re$ult$ void dft%$#ort P3( $#ort =( int Pout* EE!)- function J int $um1e D 2( $um0m D 2I EEinit realEimag component$ float c$ D 2( $n D 2I EEinit co$ineE$ine component$ int i D 2I for %i D 2I i G SI iOO* EEfor S8point !)J c$ D co$%2PpiP%=*PiES*I EEreal component $n D $in%2PpiP%=*PiES*I EEimaginar7 component $um1e D $um1e O 3BiCPc$I EE$um of real component$ $um0m D $um0m 8 3BiCP$nI EE$um of imaginar7 component$ Q outB2C D $um1eI EE$um of real component$ outB1C D $um0mI EE$um of imaginar7 component$ Q void main%* J int @I for %@ D 2I @ G SI @OO* J dft%3(@(out*I EEcall !)- function Q Q Me"ho: o2 E;4er$!e%": <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name :2".4<". Create t#e $ource file i.e. program for XdftY in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%dft.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7.
Resu,":-#e !)- of t#e an7 ar5itrar7 $e;uence #a$ 5een o5tained in t#e form of 4aveform. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: !)- computation concept 4ill 5e more ela5orated t#roug# t#i$ practical.
Fdefine P0 3.1 1"/2+"3"./,/ t7pedef $truct Jfloat real(imagIQ C<MPAE]I void ))-%C<MPAE] PZ( int n*I EE))- protot7pe float io5ufferBP-SCI EEa$ input and output 5uffer float 31BP-SCI EEintermediate 5uffer $#ort iI EEgeneral purpo$e inde3 varia5le $#ort 5uffercount D 2I EEnum5er of ne4 $ample$ in io5uffer $#ort flag D 2I EE$et to 1 57 0S1 4#en io5uffer full C<MPAE] 4BP-SCI EEt4iddle con$tant$ $tored in 4 C<MPAE] $ample$BP-SCI EEprimar7 4or=ing 5uffer main%* J for %i D 2 I iGP-S I iOO* EE $et up t4iddle con$tant$ in 4 J 4BiC.real D co$%2PP0PiE%P-SP2.2**I EE1e component of t4iddle con$tant$ 4BiC.imag D8$in%2PP0PiE%P-SP2.2**I EE0m component of t4iddle con$tant$ Q for %i D 2 I i G P-S I iOO* EE$4ap 5uffer$ J io5ufferBiC D $in%2PP0P32PiEP-S*IEP128 H fre;(122 8H $ampling fre;PE $ample$BiC.realD2.2I $ample$BiC.imagD2.2I Q for %i D 2 I i G P-S I iOO* EE$4ap 5uffer$ J $ample$BiC.realDio5ufferBiCI EE5uffer 4it# ne4 data EP io5ufferBiC D 31BiCI EEproce$$ed frame to io5ufferPE Q for %i D 2 I i G P-S I iOO* $ample$BiC.imag D 2.2I EEimag component$ D 2 ))-%$ample$(P-S*I EEcall function ))-.c
for %i D 2 I i G P-S I iOO* EEcompute magnitude J 31BiC D $;rt%$ample$BiC.realP$ample$BiC.real O $ample$BiC.imagP$ample$BiC.imag*IEEE32I Q Q EEend of main Fdefine P-S 2"+ void ))-%C<MPAE] PZ( int S* EEF of point$ for ))EEinput $ample arra7( F of point$
J C<MPAE] temp1(temp2I EEtemporar7 $torage varia5le$ int i(@(=I EEloop counter varia5le$ int upperRleg( lo4erRlegI EEinde3 of upperElo4er 5utterfl7 leg int legRdiffI EEdifference 5et4een upperElo4er leg int numR$tage$ D 2I EEnum5er of ))- $tage$ %iteration$* int inde3( $tepI EEinde3E$tep t#roug# t4iddle con$tant i D 1I EElog%5a$e2* of S point$D F of $tage$ do J numR$tage$ OD1I i D iP2I Q4#ile %iTDS*I legRdiff D SE2I EEdifference 5et4een upper&lo4er leg$ $tep D %P-SP2*ESI EE$tep 5et4een value$ in t4iddle.# EE "12 for %i D 2Ii G numR$tage$I iOO* EEfor S8point ))J inde3 D 2I for %@ D 2I @ G legRdiffI @OO* J for %upperRleg D @I upperRleg G SI upperRleg OD %2PlegRdiff** J lo4erRleg D upperRlegOlegRdiffI temp1.real D %ZBupperRlegC*.real O %ZBlo4erRlegC*.realI temp1.imag D %ZBupperRlegC*.imag O %ZBlo4erRlegC*.imagI temp2.real D %ZBupperRlegC*.real 8 %ZBlo4erRlegC*.realI temp2.imag D %ZBupperRlegC*.imag 8 %ZBlo4erRlegC*.imagI %ZBlo4erRlegC*.real D temp2.realP%4Binde3C*.real 8temp2.imagP%4Binde3C*.imagI %ZBlo4erRlegC*.imag D temp2.realP%4Binde3C*.imag Otemp2.imagP%4Binde3C*.realI %ZBupperRlegC*.real D temp1.realI %ZBupperRlegC*.imag D temp1.imagI Q inde3 OD $tepI Q legRdiff D legRdiffE2I $tep PD 2I Q @ D 2I for %i D 1I i G %S81*I iOO* EE5it rever$al for re$e;uencing data J = D SE2I 4#ile %= GD @* J @ D @ 8 =I
= D =E2I Q @ D @ O =I if %iG@* J temp1.real D %ZB@C*.realI temp1.imag D %ZB@C*.imagI %ZB@C*.real D %ZBiC*.realI %ZB@C*.imag D %ZBiC*.imagI %ZBiC*.real D temp1.realI %ZBiC*.imag D temp1.imagI Q Q returnI Q Me"ho: o2 E;4er$!e%": <pen Code Compo$er Studio( ma=e $ure t#e !SP =it i$ turned on. Start a ne4 pro@ect u$ing .Pro@ect8ne4 . pull do4n menu( $ave it in a $eparate director7%cNLtiLm7pro@ect$* 4it# name 22".4<". Create t#e $ource file i.e. program for XfftY in C language. &dd t#e $ource file$ to t#e pro@ect u$ing ?Pro<ec"Ua:: 2$,es "o 4ro<ec"@ pull do4n menu. &dd t#e lin=er command file he,,o.c!: . (Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd) &dd t#e run time $upport li5rar7 file r"s.A''.,$(Path: c:\ti\c6000\cgtools\li \rts6700.li ) Compile t#e program u$ing t#e .Pro@ect8compile. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. ?uild t#e program u$ing t#e .Pro@ect8?uild. pull do4n menu or 57 clic=ing t#e $#ortcut icon on t#e left $ide of program 4indo4. Aoad t#e program%fft.out* in program memor7 of !SP c#ip u$ing t#e )ile8load program. pull do4n menu. -o 6ie4 output grap#icall7 Select vie4 V grap# V time and fre;uenc7. Resu,":-#e grap# #a$ 5een vie4ed on t#e monitor. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: Student$ #ave under$tood t#e importance of ))- and procedure to compute it.
(igure 1. The logical structure of an ()* filter -#e proce$$ of $electing t#e filter[$ lengt# and coefficient$ i$ called filter de$ign. -#e goal i$ to $et t#o$e parameter$ $uc# t#at certain de$ired $top5and and pa$$5and parameter$ 4ill re$ult from running t#e filter. )01( )inite 0mpul$e 1e$pon$e( filter$ are one of t#e primar7 t7pe$ of filter$ u$ed in !igital Signal Proce$$ing. )01 filter$ are $aid to 5e finite 5ecau$e t#e7 do not #ave an7 feed5ac=. -#erefore( if 7ou $end an impul$e t#roug# t#e $7$tem %a $ingle $pi=e* t#en t#e output 4ill invaria5l7 5ecome zero a$ $oon a$ t#e impul$e run$ t#roug# t#e filter. -#ere are a fe4 term$ u$ed to de$cri5e t#e 5e#avior and performance of )01 filter including t#e follo4ingN (ilter +oefficients 8 -#e $et of con$tant$( al$o called tap 4eig#t$( u$ed to multipl7 again$t dela7ed $ample value$. )or an )01 filter( t#e filter coefficient$ are( 57 definition( t#e impul$e re$pon$e of t#e filter. )m,ulse *es,onse ` & filtera$ time domain output $e;uence 4#en t#e input i$ an impul$e. &n impul$e i$ a $ingle unit78valued $ample follo4ed and preceded 57 zero8valued $ample$. )or an )01 filter t#e impul$e re$pon$e of a )01 filter i$ t#e $et of filter coefficient$.
Ta, ` -#e num5er of )01 tap$( t7picall7 S( tell$ u$ a couple t#ing$ a5out t#e filter. Mo$t importantl7 it tell$ u$ t#e amount of memor7 needed( t#e num5er of calculation$ re;uired( and t#e amount of KfilteringK t#at it can do. ?a$icall7( t#e more tap$ in a filter re$ult$ in 5etter $top5and attenuation %le$$ of t#e part 4e 4ant filtered out*( le$$ rippling %le$$ variation$ in t#e pa$$5and*( and $teeper rolloff %a $#orter tran$ition 5et4een t#e pa$$5and and t#e $top5and*. $ulti,l#-.ccumulate ($.+) ` 0n t#e conte3t of )01 )ilter$( a KM&CK i$ t#e operation of multipl7ing a coefficient 57 t#e corre$ponding dela7ed data $ample and accumulating t#e re$ult. -#ere i$ u$uall7 one M&C per tap. -#ere are a couple different 5a$ic filter re$pon$e$. Eac# 4ill #ave a uni;ue fre;uenc7 re$pon$e 5a$ed on it$ cut8off fre;uenc7( t#e num5er of tap$ u$ed( it$ roll off( and amount of ripple. -#e variou$ attri5ute$ de$cri5ing a filter ma7 5e $een in t#e follo4ing diagramN
F$+ure &: -#i$ figure demon$trate$ an )01 lo4 pa$$ filter 4it# 2 tap$. 1educing t#e num5er of tap$ u$ed in t#e filter 4ill reduce t#e num5er of calculation$ to proce$$ in t#e $ignal( #o4ever( t#e ;ualit7 of t#e filtering 4ill $uffer. 1ippling 4ill 5ecome more $ever( t#e rolloff 4ill 5e le$$ $teep( and t#e pa$$5and 4ill 5e le$$ accurate. -#i$ ma7 5e $een in t#e follo4ing diagram 4#ere fe4er num5er of tap$ 4ere u$ed.
F$+ure D: :$ing onl7 11 tap$ #a$ degraded t#e filter from figure 1.
&ll filter$ ma7 5e categorized 57 t#e $ection of t#e fre;uenc7 $pectrum t#at t#e7 alter. -#e follo4ing figure$ depict $ome of t#e 5a$ic t7pe$ of digital filter$N
F$+ure /: ?andpa$$ filter$ allo4 a $ection in t#e middle of t#e $pectrum to remain.
Co:e: Finclude K)01cfg.#K Finclude Kd$=+,13.#K Finclude Kd$=+,13Raic23.#K float filterRCoeffBC DJ2.222222(82.221"/1(8 2.222 23(2.222222(2.22",2.(2.21113/(2.212"22( 82.222222(82.21.223(82.233 1+(8 2.231"2"(2.222222(2.2+3212(2.1 .22(2.222"3 (2.2+2 .( 2.222"3 (2.1 .22(2.2+3212(2.222222(82.231"2"(82.233 1+(82.21.223(8 2.222222(2.212"22( 2.21113/(2.22",2.(2.222222(82.222 23(82.221"/1(2.222222QI $tatic $#ort inR5ufferB122CI !S'+,13R&0C23RConfig config D J L 23221,( EP 2 !S'+,13R&0C23RAE)-0S6<A Aeft line input c#annel volume PE L 23221,( EP 1 !S'+,13R&0C23R10G9-0S6<A 1ig#t line input c#annel volume PEL 2322d.( EP 2 !S'+,13R&0C23RAE)-9P6<A Aeft c#annel #eadp#one volume PE L 2322d.( EP 3 !S'+,13R&0C23R10G9-9P6<A 1ig#t c#annel #eadp#one volume PE L 232211( EP !S'+,13R&0C23R&S&P&-9 &nalog audio pat# control PE L 232222( EP " !S'+,13R&0C23R!0GP&-9 !igital audio pat# control PE L 232222( EP + !S'+,13R&0C23RP<WE1!<WS Po4er do4n control PE L 2322 3( EP , !S'+,13R&0C23R!0G0) !igital audio interface format PE L 2322.1( EP . !S'+,13R&0C23RS&MPAE1&-E Sample rate control PE L 232221 EP / !S'+,13R&0C23R!0G&C- !igital interface activation PE L QI EP main%* 8 Main code routine( initialize$ ?SA and generate$ tone PE void main%* J !S'+,13R&0C23RCodec9andle #CodecI :int32 lRinput( rRinput(lRoutput( rRoutputI EP 0nitialize t#e 5oard $upport li5rar7( mu$t 5e called fir$t PE !S'+,13Rinit%*I EP Start t#e codec PE #Codec D !S'+,13R&0C23RopenCodec%2( &config*I !S'+,13R&0C23R$et)re;%#Codec( 1*I 4#ile%1* J EP 1ead a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &lRinput**I 4#ile %T!S'+,13R&0C23Rread%#Codec( &rRinput**I lRoutputD%0nt1+*)01R)0A-E1%&filterRCoeff (lRinput*I rRoutputDlRoutputI
EP Send a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( lRoutput**I EP Send a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( rRoutput**I Q EP Clo$e t#e codec PE !S'+,13R&0C23Rclo$eCodec%#Codec*I Q $igned int )01R)0A-E1%float P #( $igned int 3* J int iD2I $igned long outputD2I inR5ufferB2C D 3I EP ne4 input at 5ufferB2C PE for%iD32IiH2Ii88* inR5ufferBiC D inR5ufferBi81CI EP $#uffle t#e 5uffer PE for%iD2IiG32IiOO* output D output O #BiC P inR5ufferBiCI return%output*I Q
Me"ho: o2 E;4er$!e%": Connect C1< to t#e Soc=et Provided for A0SE <:-. Connect a Signal Generator to t#e A0SE 0S Soc=et. S4itc# on t#e Signal Generator 4it# a $ine 4ave of fre;uenc7 "22 9z. and 6p8 pD1."v. So4 S4itc# on t#e !S' and ?ring :p Code Compo$er Studio on t#e PC. Create a ne4 pro@ect 4it# name 2$r.4<". )rom t#e )ile Menu W ne4 W !SPE?0<S Configuration W$elect Xd$=+,13.cd5Y and $ave it a$ Xfir.cd5Y. &dd Xfir.cd5Y to t#e current pro@ect. &dd t#e given Xcodec.cY file to t#e current pro@ect 4#ic# #a$ t#e main function and call$ all t#e ot#er nece$$ar7 routine$. &dd t#e li5rar7 file Xd$=+,135$l.li5Y to t#e current pro@ect Pa"h W XCNLCCStudioLC+222Ld$=+,13Lli5Ld$=+,135$l.li5Y Cop7 file$ Xd$=+,13.#Y and Xd$=+,13Raic23.#Y from CNLCCStudioLC+222Ld$=+,13Linclude and pa$te it in current pro@ect. ?uild( Aoad and 1un t#e program.
Zou can notice t#e input $ignal of "22 9z. appearing on t#e C1< verif7ing t#e codec configuration. Zou can al$o pa$$ an audio input and #ear t#e output $ignal t#roug# t#e $pea=er$. Zou can al$o var7 t#e $ampling fre;uenc7 u$ing t#e !S'+,13R&0C23R$et)re; )unction in t#e Xcodec.cY file and repeat t#e a5ove $tep$. Resu,": )ilteration #a$ 5een o5$erved t#roug# t#e #ead8p#one. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard. I!4or"a%ce Co!4e"e%c$es: -#i$ practical #elp$ in de$igning of )01 filter of de$ired $pecification$ to t#e $tudent.
EE12,32(812,32(12,32(32,+,(81.32 (2113, EP9P 2"22 PE EE312(312(312(32,+,(82,/ 3(2 3+, EPAP .22 PE EE1 ""(1 ""(1 ""(32,+,(8231 2(21,3" EPAP 2"22 PE EE/2+.(8/2+.(/2+.(32,+,(8,3/"(1.3+, EP9P 222PE ,21"(8,21"(,21"(32,+,("23/(+1,1( EP9P ,222PE QI EP Codec configuration $etting$ PE !S'+,13R&0C23RConfig config D J L 23221,( EP 2 !S'+,13R&0C23RAE)-0S6<A Aeft line input c#annel volume PE L 23221,( EP 1 !S'+,13R&0C23R10G9-0S6<A 1ig#t line input c#annel volume PEL 2322d.( EP 2 !S'+,13R&0C23RAE)-9P6<A Aeft c#annel #eadp#one volume PE L 2322d.( EP 3 !S'+,13R&0C23R10G9-9P6<A 1ig#t c#annel #eadp#one volume PE L 232211( EP !S'+,13R&0C23R&S&P&-9 &nalog audio pat# control PE L 232222( EP " !S'+,13R&0C23R!0GP&-9 !igital audio pat# control PE L 232222( EP + !S'+,13R&0C23RP<WE1!<WS Po4er do4n control PE L 2322 3( EP , !S'+,13R&0C23R!0G0) !igital audio interface format PE L 2322.1( EP . !S'+,13R&0C23RS&MPAE1&-E Sample rate control PE L 232221 EP / !S'+,13R&0C23R!0G&C- !igital interface activation PE L QI EP main%* 8 Main code routine( initialize$ ?SA and generate$ tone PE void main%* J !S'+,13R&0C23RCodec9andle #CodecI int lRinput( rRinput( lRoutput( rRoutputI EP 0nitialize t#e 5oard $upport li5rar7( mu$t 5e called fir$t PE !S'+,13Rinit%*I EP Start t#e codec PE #Codec D !S'+,13R&0C23RopenCodec%2( &config*I !S'+,13R&0C23R$et)re;%#Codec( 3*I 4#ile%1* J EP 1ead a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &lRinput**I EP 1ead a $ample to t#e rig#t c#annel PE 4#ile %T!S'+,13R&0C23Rread%#Codec( &rRinput**I lRoutputD001R)0A-E1%&filterRCoeff (lRinput*I rRoutputDlRoutputI EP Send a $ample to t#e left c#annel PE 4#ile %T!S'+,13R&0C23R4rite%#Codec( lRoutput**I EP Send a $ample to t#e rig#t c#annel PE
4#ile %T!S'+,13R&0C23R4rite%#Codec( rRoutput**I Q EP Clo$e t#e codec PE !S'+,13R&0C23Rclo$eCodec%#Codec*I Q $igned int 001R)0A-E1%con$t $igned int P #( $igned int 31* J $tatic $igned int 3B+C D J 2( 2( 2( 2( 2( 2 QI EP 3%n*( 3%n81*( 3%n82*. Mu$t 5e $tatic PE $tatic $igned int 7B+C D J 2( 2( 2( 2( 2( 2 QI EP 7%n*( 7%n81*( 7%n82*. Mu$t 5e $tatic PE int tempD2I temp D %$#ort int*31I EP Cop7 input to temp PE 3B2C D %$igned int* tempI EP Cop7 input to 3B$tage$CB2C PE temp D % %int*#B2C P 3B2C* I EP ?2 P 3%n* PE temp OD % %int*#B1C P 3B1C*I EP ?1E2 P 3%n81* PE temp OD % %int*#B1C P 3B1C*I EP ?1E2 P 3%n81* PE temp OD % %int*#B2C P 3B2C*I EP ?2 P 3%n82* PE temp 8D % %int*#B C P 7B1C*I EP &1E2 P 7%n81* PE temp 8D % %int*#B C P 7B1C*I EP &1E2 P 7%n81* PE temp 8D % %int*#B"C P 7B2C*I EP &2 P 7%n82* PE EP !ivide temp 57 coefficient$B&2C PE temp HHD 1"I if % temp H 32,+, * J temp D 32,+,I Q el$e if % temp G 832,+,* J temp D 832,+,I Q 7B2C D temp I EP S#uffle value$ along one place for ne3t time PE 7B2C D 7B1CI EP 7%n82* D 7%n81* PE 7B1C D 7B2CI EP 7%n81* D 7%n* PE 3B2C D 3B1CI EP 3%n82* D 3%n81* PE 3B1C D 3B2CI EP 3%n81* D 3%n* PE EP temp i$ u$ed a$ input ne3t time t#roug# PE return %tempGG2*I Q
Me"ho: o2 E;4er$!e%": Connect C1< to t#e Soc=et Provided for A0SE <:-. Connect a Signal Generator to t#e A0SE 0S Soc=et. S4itc# on t#e Signal Generator 4it# a $ine 4ave of fre;uenc7 "22 9z. and 6p8 pD1."v. So4 S4itc# on t#e !S' and ?ring :p Code Compo$er Studio on t#e PC. Create a ne4 pro@ect 4it# name $$r.4<". )rom t#e )ile Menu W ne4 W !SPE?0<S Configuration W$elect Xd$=+,13.cd5Y and $ave it a$ Xiir.cd5Y. &dd Xiir.cd5Y to t#e current pro@ect. &dd t#e given Xcodec.cY file to t#e current pro@ect 4#ic# #a$ t#e main function and call$ all t#e ot#er nece$$ar7 routine$. &dd t#e li5rar7 file Xd$=+,135$l.li5Y to t#e current pro@ect Pa"h W XCNLCCStudioLC+222Ld$=+,13Lli5Ld$=+,135$l.li5Y Cop7 file$ Xd$=+,13.#Y and Xd$=+,13Raic23.#Y from CNLCCStudioLC+222Ld$=+,13Linclude and pa$te it in current pro@ect. ?uild( Aoad and 1un t#e program. Zou can notice t#e input $ignal of "22 9z. appearing on t#e C1< verif7ing t#e codec configuration. Zou can al$o pa$$ an audio input and #ear t#e output $ignal t#roug# t#e $pea=er$. Zou can al$o var7 t#e $ampling fre;uenc7 u$ing t#e !S'+,13R&0C23R$et)re; )unction in t#e Xcodec.cY file and repeat t#e a5ove $tep$. O-ser>a"$o%s: )iltration #a$ 5een o5$erved t#roug# #ead8p#one. Precau"$o%s: 1* Connect t#e 4ire properl7 2* Po4er ca5le $#ould 5e connected after t#e connection of data ca5le in t#e !S' 5oard.
I!4or"a%ce Co!4e"e%c$es: -#i$ practical #elp$ in de$igning of 001 filter of de$ired $pecification$ to t#e $tudent.