Anda di halaman 1dari 22

Introduction to DSP using Labview

Lab 3 Tutor: Dr Alison Carrington a.l.carrington@staffs.ac.uk http://www.fcet.staffs.ac.uk/alg1/

Digital Signal Processing(CE00063-3) Lab 3

Page 1/22

Introduction
This lab introduces you to digital filter implementation on the NI-SPEEDY-33 target DSP board. The design will be carried out using the Labview Filter Design Toolkit and the implementation using Labview DSP module and the NI-SPEEDY-33 target DSP board.

Background Reading
Read the online tutorials on the NI website: http://zone.ni.com/devzone/cda/tut/p/id/3594#toc0 NI-SPEEDY-33 board Manual: http://www.ni.com/pdf/manuals/371577b.pdf Online video tutorials: http://www.fcet.staffs.ac.uk/mma2/dsp/dsp.htm DSP tutorial: http://www.bores.com/

Additional Reading
Consider spending some time at www.ni.com there are a number of free online tutorials.

Digital Signal Processing(CE00063-3) Lab 3

Page 2/22

This section guides you to using Labviews project manager


1. Create A New Project
LabVIEW 8.20 allows users to create projects for the DSP Module in two ways, using the DSP project wizard or manually.

Using the DSP Project Wizard to create a new project

Launch LabVIEW 8.20. You will see the following launch screen:

Figure 1. The LabVIEW 8.20 Launch Screen

On the lower left corner of the launch screen notice that under the targets section, DSP Project is highlighted. Click on the GO button to launch the DSP Project Wizard This will bring you to the first screen of the DSP Project Wizard as shown in figure 2. This lets you choose whether you want to include a new project with a new VI or an existing VI. If the option to use an existing VI is chosen, then

Digital Signal Processing(CE00063-3) Lab 3

Page 3/22

the VI path needs to be specified in the dialog below the Project Type dialog. For this tutorial, we are going to choose a Blank VI.

Figure 2. Define the Project

Click on Next. In the next step you can choose the DSP target of your choice as shown in figure 3. The DSP project wizard only allows you to choose one DSP target. More targets may be added after the project is created.

Digital Signal Processing(CE00063-3) Lab 3

Page 4/22

Figure 3. Select Target and I/O options

Note that you can also choose what I/O of the board you want to include your project. This is a software-only feature which means that even if you do not add an I/O to your project, it still exists in hardware but you will not be able to access the I/O in LabVIEW

Clicking on Finish will help create a LabVIEW Project that includes the chosen target and I/O as shown in figure 4.

Figure 4. The LabVIEW Project with NI SPEEDY-33 and Chosen I/O

You can now build your VI as you normally would in LabVIEW. Note that the VI that is created here (Untitled 1) resides under SPEEDY-33. This is because this particular VI will run on the SPEEDY-33 DSP board. To find out more information on how to add new targets and add existing/new VIs, refer to the other sections of this tutorial

Creating a new project manually

Launch LabVIEW 8.20. You will see the splash screen in figure 5. Select the Empty Project from New

Digital Signal Processing(CE00063-3) Lab 3

Page 5/22

Figure 5. Create A New Project Manually

LabVIEW will create a blank project that includes your host computer as the only target as shown in figure 6

Figure 6. An Empty Project

Now you can add the necessary DSP target and I/O to this project. To add a new target to a LabVIEW project, right-click on Project:Untitled Project 2 or whatever the name of the project is for your application. From the menu, select New >> Targets and Devices

Digital Signal Processing(CE00063-3) Lab 3

Page 6/22

If you have the DSP board connected to your computer, select the first option Existing target or device and LabVIEW will automatically detect the target for you. You can also add your target manually by selecting the third option New target or device Selecting this option will show you all the four supported targets in LabVIEW DSP Module (Note: You may see other targets if you have LabVIEW FPGA and LabVIEW Real-time modules installed)

Figure 7. Adding A Target to a Project

Select SPEEDY-33 from this list and click OK LabVIEW creates a new item under the project hierarchy called the SPEEDY-33 as shown in figure 8. You can also rename the target to make it recognizable especially if you have multiple targets connected.

Digital Signal Processing(CE00063-3) Lab 3

Page 7/22

Figure 8. The New Target is Added to the Project

Note that as it stands the SPEEDY-33 item does not include an I/O points in the project. To add an I/O point (analog input, analog output, digital input or digital output), right-click on the SPEEDY-33 in the project and select New >> Elemental I/O. You will see a screen similar to figure 9.

Figure 9. Adding Elemental I/O to a target

You can choose to add all the I/O points or only those that you wish to use in your current project. This does not change the hardware properties. This only affects what I/O you can access. If you are not sure what you want to use, we recommend that you add all the I/O points. After adding the I/O points, you should see something similar to figure 10

Digital Signal Processing(CE00063-3) Lab 3

Page 8/22

Figure 10. Adding all the I/O points to the Project

Click on OK. Your project should now look similar to figure 11

Figure 11. Project After Adding All I/O Points in LabVIEW

You have successfully created a project in LabVIEW that targets the DSP module.

Digital Signal Processing(CE00063-3) Lab 3

Page 9/22

Adding a new or existing VI to a LabVIEW Project

This section assumes that you either have a project with a DSP target and I/O points already created similar to figure 12. If you need information on how to create one, please refer to the previous section. You may also have VIs already included.

Figure 12. A Project with a DSP target and I/O points in LabVIEW

To add a new VI to the project:

Right-click on the SPEEDY-33 item in the project and select New >> VI

Figure 13. Adding a New VI to the LabVIEW Project

Digital Signal Processing(CE00063-3) Lab 3

Page 10/22

To add an existing VI to the project

Right-click on the SPEEDY-33 item in the project and select Add File and select the appropriate VI you would like to add. After adding the file, your project will look similar to figure 14.

Figure 14. Adding an existing VI to a LabVIEW project

Now, you may work with the VIs as you would normally would in LabVIEW. To open the VI, just double-click on it in the project.

Creating a Build Specification to Flash a DSP Board

LabVIEW Projects give you the option to have multiple build specifications for your DSP board, thereby helping you save time and make it easy to recompile and flash your VIs onto the DSP board To create a build specification right click on Build Specification under the SPEEDY-33 DSP item in the project (similar to the one shown in figure 15)

Digital Signal Processing(CE00063-3) Lab 3

Page 11/22

Figure 15. To create a build specification, right-click on Build Specifications

Select New >> Flash Memory Build In the screen that follows as shown in figure 16, give your build a name that is descriptive of the application. For example in this case, we are going to perform convolution, hence we have named Convolution.

Figure 16. Give your build a unique name

Next, in the Source File item, select the VIs that you would like to flash to the DSP memory

Digital Signal Processing(CE00063-3) Lab 3

Page 12/22

Figure 17. Select the VI you would like to download to Flash

Click on OK Now, to compile and flash the DSP with the selected VI, right-click on the build name and select Deploy

Digital Signal Processing(CE00063-3) Lab 3

Page 13/22

Open a blank VI and build the following front panel.

Figure 1. Front Panel of Example 1

1. Place a waveform graph, located on the ControlsGraphs palette and change the label from default Waveform Graph to Input Signal - Time Domain (by double clicking on the label). We will simulate a sine wave and display it in this graph. The timing characteristics of the sine wave will be the following: samples per second: 8000, number of samples: 128.

2. From the Properties shortcut menu, under Scales tab disable the Autoscale options for X and Y Axis. Change the x-axis minimum value to 0 and maximum value to 128. Change the y-axis minimum value to be -5000 and maximum value to 5000.

3. Place another waveform graph to display the frequency domain of the input signal and label it Input Signal - Frequency Domain.

4. From the Properties shortcut menu, under the Scales tab disable the Autoscale options for the both axis. For x-axis change the name to Frequency (Hz), and set the minimum value to 0 and maximum value to 4000. Since we will sample at 8000 Hz with 128 number of samples, set the Multiplier to 62.5 (8000/128). For y-axis set the minimum value to 0 and maximum value to 5000.

Digital Signal Processing(CE00063-3) Lab 3

Page 14/22

5. Figure 2. Input Signal - Frequency Domain Graph Properties a. Place two Horizontal Pointer Slides from ControlsNumeric palette and label them Frequency (Hz) and Amplitude. Set the maximum scale range of Frequency (Hz) slider to 2000 and the maximum scale range of Amplitude slider to 5000. 6. Build the following block diagram.

Figure 3. Block Diagram of Example 1 a. Place the Simulate Signal Express VI located on the Functions Embedded Signal Generation palette. Double click on the Express VI
Digital Signal Processing(CE00063-3) Lab 3

Page 15/22

and configure it to have a Signal Type of Sine. Check the Add noise box and choose Uniform White Noise for the Noise type. Wire the Amplitude and Frequency (Hz) terminals to corresponding inputs of the Simulate Signal Express VI. Wire the Sine with Uniform output of the VI to Input Signal Time Domain graph terminal.

Figure 4. Configuration Window for Simulate Signal Express VI b. Place the Spectral Measurements Express VI from FunctionsSignal ProcessingFrequency Domain palette. Double click on the Express VI to configure it. Select the Magnitude (peak) option under Spectral Measurement and click OK. Wire the Sine with Uniform output of Simulate Signal VI to Signals input of Spectral Measurements. c. Wire the FFT (Peak) output of the Express VI to Input Signal Frequency Domain graph terminal. d. Place a While Loop located under FunctionsStructures palette, on the block diagram. e. Save the VI as Example 1.vi. 7. Adjust the Frequency and Amplitude values and run the VI. LabVIEW DSP Module Status Monitor dialog box will open. After being compiled and downloaded to target, the VI starts running on the target hardware. As the VI runs, change these values and observe the graphs in time and frequency domains.

Digital Signal Processing(CE00063-3) Lab 3

Page 16/22

8. Target the LabVIEW DSP Module to execute on Windows by choosing OperateSwitch Execution TargetLabVIEW for Windows from the menu. 9. Run the VI again. 10. Save and close Example1.vi.

Digital Signal Processing(CE00063-3) Lab 3

Page 17/22

This section guides you to using the DSP board peripherals


Using analogue input, RMS sub-vi and LEDS
This VI demonstrates how to use RMS sub-vi to implement a VU metre. 1. Create and run the following VI. 2. Talk in front of the boards Mic. 3. Observe the Energy levels calculated by the RMS sub-VI.

Front Panel

Digital Signal Processing(CE00063-3) Lab 3

Page 18/22

Block Diagram

Digital Signal Processing(CE00063-3) Lab 3

Page 19/22

Using property nodes for event driven A/D access


This VI demonstrates how to use property nodes to process data frames from the A/D only when the Valid Output flag is true. 4. Create and run the following VI. 5. Observe the ratio between the number of executed frames and number of processed frames. 6. Alter the sampling rate (SPEEDY-33 board only) and observe the ratio between processed to executed frames.

Front Panel

False Case

VI Block Diagram

Digital Signal Processing(CE00063-3) Lab 3

Page 20/22

Band-stop filter
This VI demonstrates how to implement an FIR band-stop (notch) filter. The filter has a stop-band between 950 and 1050 Hz. Create and run the following VI. 1. Observe how the VI filters out the sine wave when you enter a Frequency around 1000 Hz. 2. How many delay lines are in this filter 3. Modify the VI to display the filter transfer function.

Front Panel

Block Diagram
Digital Signal Processing(CE00063-3) Lab 3

Page 21/22

Sine wave properties (Double click on the sine wave icon)

Filter Proparties
Digital Signal Processing(CE00063-3) Lab 3

Spectral Measurements

Page 22/22

Anda mungkin juga menyukai