<< 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?

Step 9: test-vector simulation

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 h you generated using gen_filt above. Note that this operation will yield a vector of length 507 (which is n m 1 , where n is the length of the filter and m 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.

The test vector is stored in the ".etext" section. See Core File: Introduction to Six-Channel Board for TI EVM320C54 for more information on the DSP memory sections, including a memory map.
The memory block that holds the test vector is large enough to hold a vector up to 4,000 elementslong. The test vector stores data for both channels of input and from all six channels of output.

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:

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 320 - spring 2003. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10096/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 - spring 2003' conversation and receive update notifications?

Ask