You are on page 1of 49

DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.

Course : B.Tech. (ECE)


YearSe!es"er:III#I
Sess$o%: &''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
L T P
' ' &
S. No. NAME OF T0E E1PERIMENT
1. Sampling & Waveform Generation.
2. Quantization
3. PCM Encoding
. !elta Modulation
". !igital Modulation Sc#eme$ %&S'( PS'( )S'*
+. Error Correcting Code$
,. !)- Computation.
.. )a$t )ourier -ran$form.
/. )01 )ilter implementation.
12. 001 )ilter implementation.
11. !SP Proce$$or 0mplementation
12. Computational E3periment$ 4it# !igital )ilter$
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
L$s" o2 E3u$4!e%" 2or D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
S.No. E3u$4!e%"
5"6(N
os.)
Fu%c"$o%a, S"a"us
7or8$%+ No%)7or8$%+
1 -MS322C+,13 !S'
development 5oard
9' 9' NIL
2 E3ternal "6!C po4er $uppl7 9' 9' NIL
3 0EEE 12. compliant male8
to8female ca5le
9' 9' NIL
233M9z or 9ig#er Pentium8
Compati5le CP:
9/ 9/ NIL
" Monitor 9/ 9/ NIL
+ )re;uenc7 Generator & & NIL
, C1< & & NIL
. Spea=er >ac= / / NIL
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
L$s" o2 Co%su!a-,es 2or D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
S.No. I"e!s 5ua%"$"6 (Nos.)
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
Course : B.Tech. (ECE)
YearSe!es"er:III#I
Sec"$o%:C9C&
L$s" o2 S"u:e%"s o2 EC #I Se!es"er 2or "he Sess$o% &''()'*
S.No. Roll No. Name
Group C1
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
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

DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)9
O-<ec": Sampling and Waveform Generation.
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12. compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use:: 0n $ignal proce$$ing( $ampling i$ t#e reduction of a continuou$ $ignal to
a di$crete $ignal. & common e3ample i$ t#e conver$ion of a $ound 4ave %a continuou$8time
$ignal* to a $e;uence of $ample$ %a di$crete8time $ignal*.
Aet x%t* 5e a continuou$ $ignal 4#ic# i$ to 5e $ampled( and t#at $ampling i$ performed 57
mea$uring t#e value of t#e continuou$ $ignal ever7 T $econd$. -#u$( t#e $ampled $ignal xBnC
given 57
xBnC D x%nT*( 4it# n D 2( 1( 2( 3( ...
-#e $ampling fre;uenc7 or $ampling rate fs i$ defined a$ t#e num5er of $ample$ o5tained in one
$econd( or fs D 1ET. -#e $ampling rate i$ mea$ured in #ertz or in $ample$ per $econd.
Co:e:
For =a>e2or! +e%era"$o%:
FincludeG$tdio.#H
FincludeGmat#.#H
FincludeG$tdli5.#H
float 3B,22CI
void main%*
J
float &()()$I
int i(c#oice(=(nI
printf%K Generation of di$crete time $ignal$ LnK*I
printf%KLnEnter t#e fre;uenc7 of analog $ignal ) D K*I
$canf%KMfK(&)*I EEfre;uenc7 of t#e $ignal
printf%KEnter t#e $ampling fre;uenc7 )$ D K*I
$canf%KMfK(&)$*I EE$ampling fre;uenc7
printf%KLnEnter 7our c#oiceK*I
printf%KLnco$ine 4ave %Enter 1*K*I EEco$ine 4ave
printf%KLn$ine 4ave %Enter 2*K*I EE$ine 4ave
printf%KLn$;uare 4ave %Enter 3*K*I EE$;uare 4ave
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.11"/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.11"/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(82+(122+(
11,2(8132+(82.",(1""(1222+(1,3/(1222+(1""(82.",(
8132+(11,2(122+(82+(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
23223( 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%ceCo!4e"e%c$es: Student$ #ave no4 under$tood t#e 5a$ic concept of $ampling and
#o4 an7 4aveform i$ generated and $ampled.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)&
O-<ec": Quantization
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use:: Wit# t#e ad@ective KdigitalK 4e indicate t#o$e $7$tem$ t#at 4or= on
$ignal$ t#at are repre$ented 57 num5er$( 4it# t#e %finite* preci$ion t#at computing $7$tem$ allo4.
:p to no4 4e #ave con$idered di$crete8time and di$crete8$pace $ignal$ a$ if t#e7 4ere
collection$ of infinite8preci$ion num5er$( or real num5er$. :nfortunatel7( computer$ onl7 allo4
to repre$ent finite $u5$et$ of rational num5er$. -#i$ mean$ t#at our $ignal$ are $u5@ect to
;uantization.
)or our purpo$e$( t#e mo$t intere$ting ;uantization i$ t#e linear one( 4#ic# i$ u$uall7 occurring
in t#e proce$$ of conver$ion of an analog $ignal into t#e digital domain. 0f t#e memor7 4ord
dedicated to $toring a num5er i$ made of 5it$( t#en t#e range of $uc# num5er i$ di$cretized into
2

;uantization level$. &n7 value t#at i$ found 5et4een t4o ;uantization level$ can 5e
appro3imated 57 truncation or rounding to t#e clo$e$t value. -#e )igure 1 $#o4$ an e3ample of
;uantization 4it# repre$entation on 3 5it$ in t4o[$ complement.
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
23223( 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 8I
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%ceCo!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.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)D
O-<ec": PCM Encoding
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use:: Pul$e8code modulation %PCM* i$ a digital repre$entation of an analog
$ignal 4#ere t#e magnitude of t#e $ignal i$ $ampled regularl7 at uniform interval$( t#en
;uantized to a $erie$ of $7m5ol$ in a digital %u$uall7 5inar7* code.
9ere i$ one e3ample of $ine 4ave $#o4n in figure. -#e $ine 4ave i$ $ampled at regular interval$(
)or eac# $ample( one of t#e availa5le value$ i$ c#o$en 57 $ome algorit#m in t#i$ ca$e( t#e ceiling
function i$ u$ed. -#i$ produce$ a full7 di$crete repre$entation of t#e input $ignal t#at can 5e
ea$il7 encoded a$ digital data for $torage or manipulation. )or t#e $ine 4ave e3ample at rig#t( 4e
can verif7 t#at t#e ;uantized value$ at t#e $ampling moment$ are /( 11( 12( 13( 1( 1( 1"( 1"( 1"(
1( etc. Encoding t#e$e value$ a$ 5inar7 num5er$ 4ould re$ult in t#e follo4ing $et of ni55le$N
1221( 1211( 1122( 1121( 1112( 1112( 1111( 1111( 1111( 1112( etc. -#e$e digital value$ could t#en
5e furt#er proce$$ed or anal7zed 57 a purpo$e8$pecific digital $ignal proce$$or or general
purpo$e CP:.
-#ere are man7 4a7$ to implement a real
device t#at perform$ t#i$ ta$=. 0n real $7$tem$(
$uc# a device i$ commonl7 implemented on a
$ingle 0ntegrated !evelopment Environment
generall7 referred to a$ an &!C %analog8to8
digital converter*. -#e$e device$ 4ill produce
on t#eir output a 5inar7 repre$entation of t#e
input 4#enever t#e7 are triggered 57 a cloc=
$ignal( generated 57 !SP proce$$or mean$
22"M9z.
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 12I
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%ceCo!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.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)G
O-<ec": !elta Modulation
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use:: !elta modulation %!M or ^8modulation* i$ an analog8to8digital and
digital8to8analog $ignal conver$ion tec#ni;ue u$ed for tran$mi$$ion of voice information 4#ere
;ualit7 i$ not of primar7 importance. !M i$ t#e $imple$t form of differential pul$e8code
modulation %!PCM* 4#ere t#e difference 5et4een $ucce$$ive $ample$ i$ encoded into n85it data
$tream$. 0n delta modulation( t#e tran$mitted data i$ reduced to a 185it data $tream.
0t$ main feature$ areN
t#e analog $ignal i$ appro3imated 4it# a $erie$ of $egment$
eac# $egment of t#e appro3imated $ignal i$ compared to t#e original analog 4ave to
determine t#e increa$e or decrea$e in relative amplitude
t#e deci$ion proce$$ for e$ta5li$#ing t#e $tate of $ucce$$ive 5it$ i$ determined 57 t#i$
compari$on
onl7 t#e c#ange of information i$ $ent( t#at i$( onl7 an increa$e or decrea$e of t#e $ignal
amplitude from t#e previou$ $ample i$ $ent 4#erea$ a no8c#ange condition cau$e$ t#e
modulated $ignal to remain at t#e $ame 2 or 1 $tate of t#e previou$ $ample.
-o ac#ieve #ig# $ignal8to8noi$e ratio( delta modulation mu$t u$e over$ampling tec#ni;ue$( t#at
i$( t#e analog $ignal i$ $ampled at a rate $everal time$ #ig#er t#an t#e S7;ui$t rate.
1at#er t#an ;uantizing t#e a5$olute value of t#e input analog 4aveform( delta modulation
;uantize$ t#e difference 5et4een t#e current and t#e previou$ $tep( a$ $#o4n in t#e 5loc=
diagram in )igure
)ig. 1 8 ?loc= diagram of a ^8modulatorEdemodulator
-#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.1PfcPiE122*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.1PfmP@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.1PfcP=E122* O?etaP$in%2P3.1PfmP=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%ceCo!4e"e%c$es:!elta modulated $ignal advantage$ in !SP application under$tood
from t#i$ practical and al$o it$ practical application$.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)/
O-<ec": !igital Modulation Sc#eme$ %&S'( )S'*
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use:: 0n digital modulation( an analog carrier $ignal i$ modulated 57 a digital
5it $tream. !igital modulation met#od$ can 5e con$idered a$ digital8to8analog conver$ion( and
t#e corre$ponding demodulation or detection a$ analog8to8digital conver$ion. -#e c#ange$ in t#e
carrier $ignal are c#o$en from a finite num5er of M alternative $7m5ol$ %t#e modulation
alp#a5et*.
Fu%:a!e%"a, :$+$"a, !o:u,a"$o% !e"ho:s
-#e$e are t#e mo$t fundamental digital modulation tec#ni;ue$N
0n t#e ca$e of PS'( a finite num5er of p#a$e$ are u$ed.
0n t#e ca$e of )S'( a finite num5er of fre;uencie$ are u$ed.
0n t#e ca$e of &S'( a finite num5er of amplitude$ are u$ed.
0n t#e ca$e of Q&M( a finite num5er of at lea$t t4o p#a$e$( and at lea$t t4o amplitude$
are u$ed.
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#mol 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.1P12P@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.1P12P@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.1P"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%ceCo!4e"e%c$es: Student 4ill came to =no4 t#e advantage$ of different digital
modulation $c#eme$ and t#eir $ignal8to8noi$e performance
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.).
O-<ec": Error Correcting Code$
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7.
Theor6For!u,a Use:: & c6c,$c re:u%:a%c6 chec8 %C1C* i$ a t7pe of function t#at ta=e$ a$
input a data $tream of unlimited lengt# and produce$ a$ output a value of a certain fi3ed $ize. -#e
term C1C i$ often u$ed to denote eit#er t#e function or t#e function[$ output. & C1C can 5e u$ed
in t#e $ame 4a7 a$ a c#ec=$um to detect accidental alteration of data during tran$mi$$ion or
$torage. )or e3ampleN
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 x
3
O x
2
O x 57 x O 1. We 4ould find t#at
Co:e:
EP !ESC10P-0<S P
P P
P Program for t#e error detection
P
P u$ing t#e -MS322C+,13 !S'.
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 EEEnter in t#e form of 5it $tring
get$%input*I
frameRlengt#D$trlen%input*81I
for%iD2IiG$trlen%input*IiOO*
J
if%inputBiCDD[1[* dataBiCD1I
el$e dataBiCD2I
Q
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%ceCo!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
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)A
O-<ec": !)- Computation.
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7.
Theor6For!u,a Use::
0n mat#ematic$( t#e :$scre"e Four$er "ra%s2or! (DFT) i$ one of t#e $pecific form$ of )ourier
anal7$i$. &$ $uc#( it tran$form$ one function into anot#er( 4#ic# i$ called t#e fre;uenc7 domain
repre$entation( or $impl7 t#e '(T( of t#e original function %4#ic# i$ often a function in t#e time
domain*. ?ut t#e !)- re;uire$ an input function t#at i$ di$crete and 4#o$e non8zero value$ #ave
a limited %finite* duration. Suc# input$ are often created 57 $ampling a continuou$ function( li=e
a per$on[$ voice. &nd unli=e t#e di$crete8time )ourier tran$form %!-)-*( it onl7 evaluate$
enoug# fre;uenc7 component$ to recon$truct t#e finite $egment t#at 4a$ anal7zed. 0t$ inver$e
tran$form cannot reproduce t#e entire time domain( unle$$ t#e input #appen$ to 5e periodic
%forever*. -#erefore it i$ often $aid t#at t#e !)- i$ a tran$form for )ourier anal7$i$ of finite8
domain di$crete8time function$.
!i$crete )ourier -ran$form %!)-* i$ an operation to evaluate t#e )- of t#e $ampled $ignal $%n* D
$%n-* 4#ere - i$ $ampling time 4it# a finite num5er of $ample$ %$a7 *. 0t i$ defined a$
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.11+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%ceCo!4e"e%c$es: !)- computation concept 4ill 5e more ela5orated t#roug# t#i$
practical.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)(
O-<ec": )a$t )ourier -ran$form.
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7.
Theor6For!u,a Use: : & 2as" Four$er "ra%s2or! %FFT* i$ an efficient algorit#m to compute
t#e di$crete )ourier tran$form %!)-* and it$ inver$e. ))-$ are of great importance to a 4ide
variet7 of application$( from digital $ignal proce$$ing and $olving partial differential e;uation$ to
algorit#m$ for ;uic= multiplication of large integer$. -#i$ article de$cri5e$ t#e algorit#m$( of
4#ic# t#ere are man7I $ee di$crete )ourier tran$form for propertie$ and application$ of t#e
tran$form.
Aet x2( ....( x%81 5e comple3 num5er$. -#e !)- i$ defined 57 t#e formula
Evaluating t#e$e $um$ directl7 4ould ta=e <%%
2
* arit#metical operation$. &n ))- i$ an
algorit#m to compute t#e $ame re$ult in onl7 <%% log %* operation$. 0n general( $uc# algorit#m$
depend upon t#e factorization of %( 5ut %contrar7 to popular mi$conception* t#ere are ))-$ 4it#
<%% log %* comple3it7 for all %( even for prime %.
Man7 ))- algorit#m$ onl7 depend on t#e fact t#at i$ an %t# primitive root of unit7( and t#u$
can 5e applied to analogou$ tran$form$ over an7 finite field( $uc# a$ num5er8t#eoretic
tran$form$.
Since t#e inver$e !)- i$ t#e $ame a$ t#e !)-( 5ut 4it# t#e oppo$ite $ign in t#e e3ponent and a
1E% factor( an7 ))- algorit#m can ea$il7 5e adapted for it a$ 4ell.
Co:e:
EPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
P !ESC10P-0<S P
P Sum5er of point$ for ))- %P-S* 2"+ P P
P io5uffer 88H input $ignal P
P $ample 88H output of ))- function %don[t u$e on grap# 4indo4*
P 31 88H u$e in grap# 4indo4
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPE
EE))-2"+c.c ))- implementation calling a C8coded ))- function
Finclude Gmat#.#H
Fdefine P-S 2"+ EEF of point$ for ))-
Fdefine P0 3.11"/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"+ EEF of point$ for ))-
void ))-%C<MPAE] PZ( int S* 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%ceCo!4e"e%c$es: Student$ #ave under$tood t#e importance of ))- and procedure to
compute it.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)*
O-<ec": )01 )ilter implementation.
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6: 0n $ignal proce$$ing( a filter remove$ un4anted part$ of t#e $ignal( $uc# a$ random
noi$e( or e3tract$ t#e u$eful part$ of t#e $ignal( $uc# a$ t#e component$ l7ing 4it#in a certain
fre;uenc7 range.
& finite impul$e re$pon$e %)01* filter i$ a filter $tructure t#at can 5e u$ed to implement almo$t
an7 $ort of fre;uenc7 re$pon$e digitall7. &n )01 filter i$ u$uall7 implemented 57 u$ing a $erie$ of
dela7$( multiplier$( and adder$ to create t#e filter[$ output. )igure 1 $#o4$ t#e 5a$ic 5loc=
diagram for an )01 filter of lengt# S. -#e dela7$ re$ult in operating on prior input $ample$. -#e
#= value$ are t#e coefficient$ u$ed for multiplication( $o t#at t#e output at time n i$ t#e
$ummation of all t#e dela7ed $ample$ multiplied 57 t#e appropriate coefficient$.
(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 G: 9ig# pa$$ filter$ remove lo4 fre;uenc7 content.
F$+ure /: ?andpa$$ filter$ allo4 a $ection in t#e middle of t#e $pectrum to remain.
F$+ure /: Stop5and filter$ remove a $ection in t#e middle of t#e $pectum.
Co:e:
Finclude K)01cfg.#K
Finclude Kd$=+,13.#K
Finclude Kd$=+,13Raic23.#K
float filterRCoeffBC DJ2.222222(82.221"/1(8
2.22223(2.222222(2.22",2.(2.21113/(2.212"22(
82.222222(82.21.223(82.2331+(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.2331+(82.21.223(8
2.222222(2.212"22(
2.21113/(2.22",2.(2.222222(82.22223(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
23223( 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%ceCo!4e"e%c$es: -#i$ practical #elp$ in de$igning of )01 filter of de$ired
$pecification$ to t#e $tudent.
DEPTT. OF ELECTRONICS AND COMMUNICATION ENGG.
&''()'*
D$+$"a, S$+%a, Process$%+ La- (TEC)./&)
E;4er$!e%" No.)9'
O-<ec": 001 )ilter implementation
E3u$4!e%" Use:: +,13 !S' ?oard( 0EEE 12.( compliant male8 to8female ca5le( computer
$7$tem( po4er $uppl7( C1<( )unction Generator( $tereo @ac=$.
Theor6For!u,a Use::
0nfinite impul$e re$pon$e %001* i$ a propert7 of $ignal proce$$ing $7$tem$. S7$tem$ 4it# t#at
propert7 are =no4n a$ ))* s#stems or 4#en dealing 4it# electronic filter $7$tem$ a$ ))* filters.
-#e7 #ave an impul$e re$pon$e function 4#ic# i$ non8zero over an infinite lengt# of time. -#i$ i$
in contra$t to finite impul$e re$pon$e filter$ %)01* 4#ic# #ave fi3ed8duration impul$e re$pon$e$.
-#e $imple$t analog 001 filter i$ an 1C filter made up of a $ingle re$i$tor %1* feeding into a node
$#ared 4it# a $ingle capacitor %C*. -#i$ filter #a$ an e3ponential impul$e re$pon$e c#aracterized
57 an 1C time con$tant.
001 filter$ ma7 5e implemented a$ eit#er analog or digital filter$. 0n digital 001 filter$( t#e output
feed5ac= i$ immediatel7 apparent in t#e e;uation$ defining t#e output. Sote t#at unli=e 4it# )01
filter$( in de$igning 001 filter$ it i$ nece$$ar7 to carefull7 con$ider Ktime zeroK ca$e in 4#ic# t#e
output$ of t#e filter #ave not 7et 5een clearl7 defined.
!e$ign of digital 001 filter$ i$ #eavil7 dependent on t#at of t#eir analog counterpart$ 5ecau$e
t#ere are plent7 of re$ource$( 4or=$ and $traig#tfor4ard de$ign met#od$ concerning analog
feed5ac= filter de$ign 4#ile t#ere are #ardl7 an7 for digital 001 filter$. &$ a re$ult( mo$tl7( if a
digital 001 filter i$ going to 5e implemented( fir$t( an analog filter %e.g. C#e57$#ev filter(
?utter4ort# filter( Elliptic filter* i$ de$igned and t#en it i$ converted to digital 57 appl7ing
di$cretization tec#ni;ue$ $uc# a$ ?ilinear tran$form or 0mpul$e invariance.
0n practice( electrical engineer$ find 001 filter$ to 5e fast and chea,( 5ut 4it# ,oorer and,ass
filtering and stailit# characteristics t#an )01 filter$.
Co:e:
Finclude K001cfg.#K
Finclude Kd$=+,13.#K
Finclude Kd$=+,13Raic23.#K
con$t $igned int filterRCoeffBC D
J
EE12,32(812,32(12,32(32,+,(81.32(2113, EP9P 2"22 PE
EE312(312(312(32,+,(82,/3(23+, EPAP .22 PE
EE1""(1""(1""(32,+,(82312(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
23223( 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*#BC P 7B1C*I EP &1E2 P 7%n81* PE
temp 8D % %int*#BC 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%ceCo!4e"e%c$es: -#i$ practical #elp$ in de$igning of 001 filter of de$ired
$pecification$ to t#e $tudent.

You might also like