National Instruments 320571-01 Car Stereo System User Manual


 
Using the DMA VIs Chapter 4
Part 4: NI-DSP Interface Utilities 4-2 NI-DSP SRM for LabVIEW for Windows
The first example is a simple spectral analyzer. The main VI is called Analyzer VI. It uses the DSP Custom
Function VI to call a custom function running on the board. The scheme is as follows:
Custom function on the board:
1. Set the data acquisition parameter and initialize the board.
2. Start the data acquisition.
while(TRUE) {
when data is ready, copy it to the process buffer
read processing information from DSP memory location 1
depending on the processing information
apply the selected window to the data
apply the selected filter to the data
compute the FFT magnitude or Power Spectrum
Transfer the data format to IEEE format.
Save processed data in DSP memory location 2.
}
In LabVIEW:
1. Initialize the board and set parameters.
2. Allocate DSP Handle Cluster 1; get the address for this handle (this is DSP memory location 1).
3. Allocate DSP Handle Cluster 2; get the address for this handle (this is DSP memory location 2).
4. Set a timeout limit to a very small number (2 ms).
5. Pass DSP Handle Cluster 1 and 2 with the other necessary parameters to the DSP Custom Function VI and
call the Analyzer VI.
6. Ignore the timeout error returned from the DSP Custom Function VI.
While(STOP button not pressed) {
send new processing information (you can change certain processing
controls from the front panel) to DSP memory location 1 using the
DSP DMA Copy(LV to DSP) VI.
copy the processed data from DSP memory location 2 to LabVIEW and
plot the data.
}
7. Call the DSP Reset VI to reset the DSP board.
The second example is the audio equalizer example. The VI loads the audio equalizer kernel called audio.out
using the DSP Load VI. It uses the DSP DMA Copy(LV to DSP) VI to send the new gains for each channel to the
DSP board and uses the DSP DMA Copy(DSP to LV) VI to copy the processed audio data back to LabVIEW and
then plots the data.
You can find all of the source codes and VIs for these two examples in the Examples subdirectory of your NI-DSP
package.
These examples show you how to use the DSP DMA Copy(DSP to LV) and DSP DMA Copy(LV to DSP) VIs to
communicate between the DSP board and the host computer. They also show you how to run parallel DSP and
LabVIEW applications, which makes the board more flexible and powerful. With a well-designed system, you can
gain both speed and flexibility.