Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006

The Basics of Using RIDE to Program DSPs

1 ratings | 5.00 out of 5
Print
The Basics of Using RIDE to Program DSPs


This tutorial will describe a RIDE design session, and will allow you to become familiar with concepts such as data flow, setup parameters, and connection logic. The walkthrough example described below will enable you to quickly build a block diagram and execute it on the SPEEDY-33 DSP hardware in real-time. To use your custom DSP hardware or industry standard DSP evaluation boards, simply select a communication driver from the RIDE environment. This example will involve analog I/O, signal generation, and parameter connection logic.


RIDE Block Components

For this example you will build a block diagram worksheet that will take speech input from the SPEEDY-33 on-board microphone and output it through the D/A to a speaker. Finding these blocks in RIDE is easy. First, press the Block Function Selector toolbar button (Figure 1) that is located on the top of the RIDE screen


[+] Enlarge Image

Figure 1 RIDE Toolbar


There are three main areas in the Block Function Selector window: (1) Library, (2) Group List, and, (3) Function List. These three areas are used to catalog the RIDE block components, and allow you to locate specific blocks. RIDE software contains a wide variety of block components that are arranged into different libraries (e.g. Simulation, Image Processing, Native Library, etc.) and function groups (e.g. Arithmetic, General, Signal Generators, etc.). You can use the Library feature to select which block component library you wish to use. In this example, you would select the Real-time Library since the two blocks you are using will run on the DSP hardware. Once you have chosen to use the Real-time Library you will notice that the Group List will change accordingly. The DSK A/D and DSK D/A blocks (Figure 2) can be found in the DSK Hardware Functions group. By highlighting this group you will cause the Block Function Selector to display the available blocks in the Function List.



Figure 2 DSK A/D Block in the Real-time Library


There are two ways to add the blocks to a worksheet; click-and-drag the block name onto the worksheet, or select the block name and then click the “Add to Worksheet” button. Arrange the blocks on the Worksheet (Figure 3).



Figure 3 Arrange RIDE Blocks to Better Understand Data Flow



Establishing the Data Flow between Blocks

RIDE provides you with three powerful ways in which to connect blocks together (Figure 4):


[+] Enlarge Image
Figure 4 RIDE Data Flow Connection Tools


1) Data Flow Connect
2) Conditional Connect
3) Data Flow Connect

You use Data Flow Connection to implement direct data flow from block to block in your worksheet. Conditional Connection allows one block’s output to govern whether or not another block (or blocks) will be allowed to run. This is useful for setting up algorithms that use “if-then” constructs (e.g. if the threshold block’s output exceeds a certain value, then the D/A block will be allowed to run). Parameter Connection allows you to use one block’s output to control a parameter of another block.



How to Connect Blocks

Each block icon is split into the source (left half) and the destination (right half) (Figure 5). The cursor will change and be labeled either ‘SOURCE’ or ‘DEST’ depending on whether the next connection should be made to a source block or a destination block. It is possible to connect to multiple destinations by first left-clicking on the source block and then use the right-mouse button to click on the destination side of each block intended to be a destination. It is important to follow the correct connection scheme.

For example, an input signal generator block connected to an output single-channel display block would use the ‘SOURCE’ cursor to select the signal generator block, and the ‘DEST’ cursor to select the single-channel display block.


Figure 5 RIDE “hot spot” for Data Flow Connection


To Connect Blocks Change to the ‘Data Flow Connect’ Mode. Enter Data Flow Connect mode by selecting the Data Flow Connect button on the toolbar. The cursor will change shape and display the word “CONNECT”. Place the cursor over the right (output) half of the DSK A/D block and left-click with the mouse. The cursor should now say “DEST”. Now place the cursor over the upper-left (input channel 0) half of the RT Add block and click. Always connect to a region WITHIN the block icon, not to the arrows – otherwise a connection will not be made.

Continue to connect blocks until all of the input and output arrows have been connected (Figure 6).


Figure 6 Completed RIDE Example



Conditional Connect

The Conditional Connect Mode is used when you need to control when the execution of block takes place. There are three variations of Conditional Connect: ‘for’, ‘while’, and (most common) ‘if’. When connected in ‘if’ mode, the controlled block will execute whenever the first data sample of the controlling block’s output is a non-zero value (TRUE), and will not execute when it is zero (FALSE). To use ‘for’ and ‘while’ structures the block being controlled must be a hierarchy type of block, which means it is made up of other blocks. The example we present here does not use a Conditional Connection.



Parameter Connect

The Parameter Connect Mode allows the parameters of a block to be set “on the fly” by other blocks. Connecting in Parameter Connect Mode is very similar to connecting in the Data Flow Connect mode. To do this you will select the Parameter Connect button on the toolbar ( ) to enter the proper connection mode, and then click on the output half of the block that will be used as the “controlling” block. Next, you will click on the block (anywhere) that is going to have its parameter adjusted. A dialog box similar to the
one shown in Figure 7 should appear when you make a parameter connection:



Figure 7 Amplitude Parameter


You’ll need to know which parameter it is that you wish to control. For this example, we’ll use a user control called ‘CD Knob’ in the worksheet to control the frequency of the Sine Generator block.

1. Select the CD-Knob block component from the Instrumentation Library and place it in your worksheet – similar to how you selected the four other blocks from the Real-time Library.

2. Enter the Parameter Connect mode (see above) and then select the CD-Knob. Next select the RT Sine Generator block. To control the frequency parameter you will need to select the ‘Frequency’ parameter shown above. This will enable you to modify the frequency of the sine waveform by simply “turning” the CD-Knob with the mouse when you run the worksheet. The final diagram should appear as shown below (Figure 8).


[+] Enlarge Image
Figure 8 Complete RIDE example with Parameter Control



Another way to control the RIDE DSP code is to use LabVIEW. Please read the application note below to see how to control RIDE from LabVIEW.



Setting Block Parameters

This is an important part of building your own DSP code. Proper parameter settings must be made for each block function in your design. Each block component may (or may not) have parameters that can be adjusted. It will be important to understand what the block parameters mean as you start building your own DSP code. Some of the more common parameters that you’ll find are Framesize and Sample Rate parameters.

Framesize will allow you to specify how many data values are produced each time the algorithm runs – basically it allows you to choose the number of data values that are operated on by the block. In many applications you will want to take care that the Framesize parameter for the block component is the same value. In this example, you should make sure that the Framesize value used for the DSK A/D block and the Sine Generator are the same for each. The same is true for the Sample Rate parameter.

To set the parameters of a block simply right-click or double-click the block. The values in the white boxes can be changed by entering a value. Any values surrounded by *() indicate parameters that are being controlled by another block (such as a CD knob or a slider). The button next to each box ( ) brings up a list of variables that may be used to set the parameter. These variables are useful when many blocks need the same value for one or more parameters. To set the variables, either press the variable button ( ) next to a
parameter or select Menu and then PC based variables.

The CD-Knob in your worksheet will need to be adjusted; that is, you’ll need to adjust its user parameters. Specifically, you’ll need to set its ‘Min Value’ parameter to a value of 0, and its ‘Max Value’ parameter to a value of 4000. This will allow you to select a value within the range of 0 to 4000. In this example, the CD-Knob has been parameter-connected to the Sine Generator block’s frequency parameter. This will result in the Sine Generator producing an output tone whose frequency is governed by the CD-Knob. You will be able to select a frequency between 0 Hz and 4000 Hz (i.e. Nyquist rate for Sine Generator’s 8000 Hz sample rate).


Run the DSP Algorithm
You can run your worksheet just as you would run any other pre-built RIDE worksheet. This is accomplished by pressing the ‘RUN’ button located on the toolbar ( ), or pressing Ctrl+F5, or select ‘RUN’ from the RIDE Control menu.

The DSP code example that we’ve described here will allow you to speak into the on-board microphone and hear your voice on the DSP hardware’s speaker output. You’ll also be able to hear a sine waveform, and adjust the frequency by using the CDKnob user control.

You have just programmed a DSP without having written a line of C or assembly code!

To take this application one step further you can modify your worksheet so that the output waveform is also graphically displayed in your worksheet. This can be performed using the RIDE user interface library, or by connecting RIDE to LabVIEW.

To learn more about RIDE visit www.hyperception.com.




1 ratings | 5.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).