Prof. Rich Kozick
ELEC 320, Fall 1997

Laboratory 4

Using the FFT on the Oscilloscopes, and
Digital Signal Processing with the dSPACE Units


One objective in this lab is to learn how to use the Fast Fourier Transform (FFT) capabilities of the oscilloscope to analyze the frequency content of signals. The other objective is to begin using the dSPACE units that are on the lab benches in room 129. The dSPACE units contain A/D and D/A circuits as well as a digital signal processing (DSP) chip. The FFT and the dSPACE units will be useful tools for the lab project in this course, which we will begin very soon.

A written report is not required for this lab. Please discuss your results with Professor Kozick as you perform the activities.

1. Using the FFT on the Oscilloscope

Begin by connecting the function generator to the oscilloscope. Set the function generator to produce a sine wave with amplitude 100 mV and frequency 1 kHz. Display the sine wave on the oscilloscope, and save this "time-domain" view of the signal as setup 1 using the SETUP key on the scope.

Now we can display the sine wave in the "frequency domain" using the FFT as follows. First, press the 1 key and turn the time-domain display of the sine wave OFF. Press the +/- key, then turn FUNCTION 2 to ON, then choose the FFT operation. (Note that the scope will also perform differentiation and integration operations.) Familiarize yourself with the various items that can be specified for the FFT display. Settings that work for the 100 mV, 1 kHz sine wave are as follows: 10 dB Units/div, 10 dB Reference Level, and on the FFT MENU: Hanning Window, Frequency Span 9.766 kHz (change with Time/Div knob and the knob next to SETUP button), and Move 0 Hz to left. Save this "frequency-domain" view of the signal as setup 2. Now you can view signals in the time-domain by recalling setup 1, and setup 2 will produce a frequency-domain view of the signal.

Please do the following exercises.

The FFT is an important and useful tool to analyze the frequency content of signals. You should now be able to use the oscilloscope to perform the FFT operation.

2. Getting Started with the dSPACE Units

It is best to access this section of the notes on the Web at
http://www.eg.bucknell.edu/~kozick/elec320/lab4.html
in order to easily follow some links to other pages.

The dSPACE boxes contain four analog-to-digital converters (ADCs), four digital-to-analog converters (DACs), and a digital signal processing (DSP) chip. The boxes allow us to write DSP programs that process real signals. The boxes can be programmed in two ways: through Simulink and through C programming. (You can also program them in assembly language!) This section will show you the steps required to program the dSPACE boxes using both methods. You can then use the dSPACE boxes to perform a project for this course. I will give you more details about the lab project next week.

Some projects that students completed in 1994 and 1995 for the Signals and Systems course are described at
http://www.eg.bucknell.edu/~eg100ee1/projects/ili.html
Please browse through these links to get an overview of the dSPACE box and the types of projects that students have performed in the past.

In order to set up your Sun account so that it can access the software for the dSPACE boxes, please perform the following steps. Every student should perform these steps today, so that all accounts are set up to access the dSPACE boxes.

  1. We need to use "tcsh" rather than "csh" as the shell so that UNIX commands can be executed from MATLAB. You can do this as follows.
  2. Edit the file named .cshrc that is located in your home directory when you log in. Add the following line at the end of the .cshrc file, and then save the file:
    source /home/charcoal/local/dsp_cit/bin/dspace.sh
    Please type carefully and check your typing before saving the file. Note that there is a space after source, and an underscore in dsp_cit. Also, you must type Return at the end of this line.
  3. Make a new directory citfiles under your home directory by typing:
    cd
    mkdir citfiles
  4. Log out, and then log back in.
  5. To verify that you can access the dSPACE software, type
    down31
    You should see an error message "Wrong number of arguments ...".

2.1. Programming with Simulink

Set up a simple DSP system in Simulink that contains only an ADC and a DAC. The system is similar to part (b) of the following figure, with the "Butterworth IIR LP Filter" omitted. Simulink for dSPACE Follow the instructions at the dSPACE Instructions Link to create a Simulink block diagram and execute it on a dSPACE box.

View the input and output signals on an oscilloscope for a sine wave input. Can you see the effects of the ADC and DAC? What happens to the output sine wave when the input sine wave frequency gets "too high"?

More advanced activities, to be performed at a later date:

2.2. Programming with C

An example C program is provided at lab1.c. Download this program to your directory, and look at the code. Ask for an explanation of the code, and then run the program on a dSPACE box, following the steps described at dSPACE Instructions. Input a signal to the dSPACE box and verify that it is sampling at the specified rate.

Then modify the program in two ways: (1) output a value that is the average of the current and previous samples, and (2) output a value that is the difference between the current and previous samples. (These will be two separate programs.) Try processing sine waves, square waves, speech, or other signals. How would you describe the operation of these two programs? Are they performing some type of filtering? What is the difference equation that relates the output values y[n] to the input values x[n]?

You can perform processing that is more interesting than merely adding or subtracting adjacent samples. The "other things" that you can do are referred to as digital signal processing (DSP) algorithms. Many interesting projects of this type are possible.

Thank you.