ELEC 320, Fall 1998
Prof. Rich Kozick

Laboratory 5

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 formal report is not required for this lab. However, there are some calculations related to FFT measurements that I would like you to submit before you leave lab today. I would expect the calculations to take approximately one page per group.

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 dBV 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/elec32098/lab5.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/~kozick/ili/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. ** SKIP STEP 1 FOR TODAY **
    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

The easiest way to program the dSPACE boxes is through Simulink. However, we need to upgrade the software for the dSPACE boxes in order for them to work with the latest version of Simulink that is running on the Suns. If and when this software is upgraded, I will provide instructions to you.

As an example of what you can do with Simulink and the dSPACE boxes, the following block diagrams implement a low-pass filter with a cutoff frequency that can be varied in real-time from the computer. Simulink for dSPACE

More advanced activities which I will show you later for your projects (if needed):

2.2. Programming with C

Important: The first time that you use the dSPACE box, save the file dspace.ini in the directory citfiles in your account.

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 sine wave signal to the dSPACE box and view the output on an oscilloscope.

Thank you.