National Instruments 320571-01 Car Stereo System User Manual


 
NI-DSP SRM for LabVIEW for Windows 2-1 Part 4: NI-DSP Interface Utilities
Chapter 2
Getting Started with the NI-DSP Interface
Utilities
This chapter contains a step-by-step example for building a custom DSP Library, creating a LabVIEW interface to a
custom function, and executing the custom function from the LabVIEW environment. The chapter demonstrates this
concept with an example of how to add a custom function. The custom function finds the maximum and minimum
values in the input array, as well as the respective indices of the occurrence of the maximum and minimum value.
This example custom function also returns an output array with the input array sorted.
Creating Your Custom NI-DSP Library
To build your own custom library, follow these steps:
1. Create your source code of C functions (or assembly functions).
2. Compile and/or assemble source code.
3. Add your object filenames to a linker file (ifile).
4. Add your new function names to a library function list file.
5. Run the Dispatch application to generate an assembly dispatch file.
6. Compile, assemble, and link your custom library.
These steps are detailed in the following pages.
Note: You can use the source files included in the Examples directory instead of creating the files in this
example.
1. Create Your Source Code of C Functions
The first step in building a custom DSP Library is to create your WE DSP32C C-callable custom function(s). The
gmaxmin.c example file in your examples directory contains the source code.
GMaxMin.c Example:
/* DSP_GMaxMin(z,y,max,min,n,imax,imin)
* This function returns the maximum and minimum of array z, as well as the
* respective indices of the occurrence of the maximum and minimum. The output
* array y holds the input array sorted.
*/
#include "atdsp.h"
short DSP_GMaxMin(z,y,max,min,n,imax,imin)
register float *z,*max,*min;
float *y;