<< Chapter < Page | Chapter >> Page > |
After you have made the changes to all eight coefficients, run your new filter and use the oscilloscope to measure thedelay between the raw (input) and filtered (delayed) waveforms.
What happens to the output if you change either the scaling factor or the delay value? How many seconds long is asix-sample delay?
As a final exercise, you will find the output of the DSP for an input specified by a test vector. Then you will comparethat output with the output of a MATLAB simulation of the same filter processing the same input; if the DSPimplementation is correct, the two outputs should be almost identical. To do this, you will generate a waveform inMATLAB and save it as a test vector. You will then run your DSP filter using the test vector as input and import theresults back into MATLAB for comparison with a MATLAB simulation of the filter.
The first step in using test vectors is to generate an
appropriate input signal. One way to do this is to use theMATLAB function to generate a sinusoid that sweeps across a
range of frequencies. The MATLAB function
save_test_vector
(available as
save_test_vector.m can then
save the sinusoidal sweep to a file you will later includein the DSP code.
Generate a sinusoidal sweep and save it to a DSP test-vector file using the following MATLAB commands:
>>t=sweep(0.1*pi,0.9*pi,0.25,500); % Generate a frequency sweep>>save_test_vector('testvect.asm',t); % Save the test vector
Next, use the MATLAB
conv
command to generate a
simulated response by filtering the sweep with the filter
you generated using
gen_filt
above. Note that this operation will yield a vector of
length 507 (which is
, where
is the length of the filter and
is the length of the input). You should keep only
the first 500 elements of the resulting vector.
>>out=conv(h,t) % Filter t with FIR filter h>>out=out(1:500) % Keep first 500 elements of out
Now, modify the file
filter.asm
to use the
alternative "test vector" core file,
vectcore.asm . Rather than
accepting input from the A/D converters and sending outputto the D/A, this core file takes its input from, and saves
its output to, memory on the DSP. The test vector is storedin a block of memory on the DSP evaluation board that will
not interfere with your program code or data.
To run your program with test vectors, you will need to
modify
filter.asm
. The assembly source is
simply a text file and can be edited using the editor ofyour preference, including WordPad, Emacs, and VI. Replace
the first line of the file with two lines. Instead of:
Notification Switch
Would you like to follow the 'Ece 320 spring 2004' conversation and receive update notifications?