<< Chapter < Page | Chapter >> Page > |
Set the amplitude on the function generator to 1.0 V peak-to-peak and the pulse shape to sinusoidal. Observethe frequency response of the filter by sweeping the input signal through the relevant frequency range. What is therelevant frequency range for a DSP system with a sample rate of 44.1 kHz?
Based on the frequency response you observe, characterize the filter in terms of its type (e.g., low-pass,high-pass, band-pass) and its -6 dB (half-amplitude) cutoff frequency (or frequencies). It may help to set thetrigger on channel 2 of the oscilloscope since the signal on channel 1 may go to zero.
Once you have determined the type of filter the DSP is
implementing, you are ready to repeat the process with adifferent filter by including different coefficients
during the assembly process. The different coefficientsare in the file
coef2.asm
. Make a copy of
coef2.asm
and call it
coef.asm
.
You can now repeat the assembly and testing process with
the new filter using the
asm
instruction atthe
DOS
prompt and repeating the steps
required to execute the code discussed in
Step 4 .
Just as you did in Step 4 , determine the type of filter you are running and thefilter's -6 dB point by testing the system at various frequencies.
In this step, you will use MATLAB to verify the frequency
response of your filter by copying the coefficients fromthe DSP to MATLAB and displaying the magnitude of the
frequency response using the MATLAB command
freqz
.
The FIR filter coefficients included in the file
coef.asm
are stored in memory on the DSP
starting at location (in hex)
0x1000
, and
each filter you have assembled and run has eightcoefficients. To view the filter coefficients as signed
integers, select the
Memory
option from the
View
menu to bring up a
Memory Window
Options
box. In the appropriate fields, set the
starting address to
0x1000
and the format to
16-Bit Signed Int
. Click "OK" to open a
memory window displaying the contents of the specifiedmemory locations. The numbers along the left-hand side
indicate the memory locations.
In this example, the filter coefficients are placed in
memory in decreasing order; that is, the last coefficient,
, is at location
0x1000
and the first
coefficient,
, is stored at
0x1007
.
Now that you can find the coefficients in memory, you are
ready to use the MATLAB command
freqz
to view
the filter's response. You must create a vector in MATLABwith the filter coefficients to use the
freqz
command. For example, if we want to view the response of
the three-tap filter with coefficients -10, 20, -10 we canuse the following commands in MATLAB:
h = [-10, 20, -10];
plot(abs(freqz(h)))
Note that you will have to enter eight values, the
contents of memory locations
0x1000
through
0x1007
, into the coefficient vector,
.
Does the MATLAB response compare with your experimental results? What might account for any differences?
Notification Switch
Would you like to follow the 'Dsp laboratory with ti tms320c54x' conversation and receive update notifications?