ELE
CTRIC
AL E
NGINEERING
113L
Digital
Signal
Processing
Laboratory
@ 1998, Dr.
Y1.
Wer ter
L
ecture
4:
Dig
ital
Wav
e
form
G
en
e
rat
ors
Intr oduction
Dig
ita
l signal
pro
cessors can be progr
ammed
to generate ar
bitr
ary waveforms wi
th
great
pr
ecision and flexibility.
In
this
experiment , we will program the TM S320G54x chip to gene
ra
te sine waves using a simple modification of
the
trad
itional t
abl
e lookup
met
hod . This is useful in communications (e.g., fr
equ
ency
hopp
ed modems, phaseshift
keyed modems, spread spectrum), testing (e.g., precision signal generators)
and
contr
ol applications.
A waveform (or function) generator is an integrat ed part of many app lications
impl
emented on
digita
l signal pro
cessors.
In today 's
exp
eriment we will study the implem
entat
ion of sine wave, triangular
wave and sq uare wave
gene
ra
tors on
the
TMS320C54x chip.
Sinewave
generator
by difference equation
Ther
e
are
many
ways to gene
rat
e sinusoidal signals using digital signal processors.
On
e
method
is
based
on the
secondorder difference equation
y(n)
=
BI
.x (n

1)
+
AI.y
(n

1)
+
A2
.y(n

2)
If
we set
B
I
=
1,
A l
=
2cos(O),
and
A
2
=
1
,
then
with
the
de
lta
function
(x( n)
=
8(n»
as in
put
(x(
n
=
0)
=
1 and
x(n )
=
0 for n
:f.
0), we will have a sinusoidal sol
ution
.
If
we,
the
refore, calc
ulate
yen)
from t his eq
uat
ion recursively,
we will
get
a sinusoidal response as
out
put .
The
sinusoidal oscillation results from a pair of poles on
the
u
nit
circle of
th
e Zplane when the coefficient
A
2
= 
L
The angle
0
of the poles on the unit circle is
deter
mined by coefficient
AI
:
th
e poles are
at
an angle
0
if
Al
=
2
cos(
O)
.
The oscillation
frequen
cy is related to this angle
0
as
F
=
(Of 2
rr
)Fs,
where
Fs
is
th
e s
am
pling frequency,
and
0
is
expressed in
ra
dians.
Thu
s, the frequen cy is given by the formula
Fs
F
=
2rrarccos (
AI/2)
From this it is cle
ar
that
for any frequency
F
below
the
folding frequency
Fs / 2,
we
must
take
the
co
rrect
coe
ffici
ent
value Al between
2
and
2.
The
amplitude of the oscillation is
1/
sin(O)
times
the
st
art
ing impulse,
x(n).
Sinewave ge
nera
tor by table lookup
method
A second way to cre
ate
a sinusoidal signal is by
table
lookup.
A table c
an
be created
which
can
then
be used to
instruct
the
D
f
A
to
output
values listed in
the
table
at
the
sample
tim
es.
Any ar bitr
ary
waveform
can
thus
be
approxim
ate
d, with
the
constrain th
at
sharp
tr
ansitions will be
smoothed
by
the
AGOl's
out
put filters.
Below is shown a
table
for sinusoidalwave,
tr
iang
ular wave,
and
squ
are
wave signals of 32 s
am
ples with a 15bit
=
16,384 extreme value.
Sinewave generator
by
lowpass filtering
For
the
DSKplus,
one
technique
is
to use
the
AGOI
A/D
and
D/
A chip 's
embedded
filters.
If
we enforce the
ouput
of the
D/
A to oscillate
betw
een two extreme values every sample period (or , in essence,
try
to
follow a square pulse)
th
en the
output
filter
will pass only the frequency compo
nents
of this signal below
the
low
pass
corner frequency.