NI-DSP ™ Software Reference Manual for LabVIEW® for Windows Digital Signal Processing Software for the PC December 1993 Edition Part Number 320571-01 © Copyright 1993 National Instruments Corporation. All Rights Reserved.
National Instruments Corporate Headquarters 6504 Bridge Point Parkway Austin, TX 78730-5039 (512) 794-0100 Technical support fax: (800) 328-2203 (512) 794-5678 Branch Offices: Australia (03) 879 9422, Austria (0662) 435986, Belgium 02/757.00.
Limited Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period.
Warning Regarding Medical and Clinical Use of National Instruments Products National Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the user or application designer.
Contents About This Manual .................................................................................................................... xi Assumption of Previous Knowledge ........................................................................................................ xi Organization of This Manual .................................................................................................................... xi Conventions Used in This Manual.............................................
Contents DSP Absolute ............................................................................................................................................ 2-4 DSP Add ................................................................................................................................................... 2-5 DSP Allocate Memory .............................................................................................................................. 2-6 DSP Blackman Window .............
Contents DSP ReFFT............................................................................................................................................... 2-66 DSP Reset ................................................................................................................................................. 2-66 DSP Reverse ............................................................................................................................................. 2-67 DSP Sawtooth Pattern....
Contents Chapter 4 Using the DMA VIs .................................................................................................................................. 4-1 DSP DMA Copy(DSP to LV)................................................................................................................... 4-3 DSP DMA Copy(LV to DSP)................................................................................................................... 4-4 Appendix A Error Codes .............................
Contents Figures Part 1 Figure 1-1. Development Paths with the NI-DSP Software ............................................................................. 1-1 Part 2 Figure 1-1. Figure 1-2. Figure 1-3. Figure 1-4. Figure 1-5. Figure 1-6. Figure 1-7. Figure 1-8. Figure 1-9. Figure 1-10. Figure 1-11. Communication between the PC and the DSP Board .................................................................... 1-1 DSP Handle Cluster ...................................................................
Contents Tables Part 1 Table 1-1. Subdirectories Created by SETUP ................................................................................................. 1-2 Part 3 Table 1-1. The NI-DSP Analysis VI Groups .................................................................................................. 1-1 Part 4 Table 2-1. Files Required to Build the Custom DSP Library Example .......................................................... 2-7 Appendix A Table A-1.
About This Manual The NI-DSP Software Reference Manual for LabVIEW for Windows explains how to use the NI-DSP software package for the LabVIEW for Windows environment. The NI-DSP software package contains the NI-DSP Analysis VIs, which are high-level digital signal processing (DSP) VIs that call the functions that execute on the AT-DSP2200 plug-in board for IBM AT bus and compatible computers.
About This Manual - Chapter 3, DSP Board Function Overview, contains an overview of the prototypes of the C-callable NI-DSP Analysis functions on the DSP board that you can use in your custom programs. - Chapter 4, Using the DMA VIs, describes two special VIs that transfer data between the host computer and the DSP board without interfering with the DSP board. • Appendix A, Error Codes, contains a list of the error codes returned by the NI-DSP Analysis VIs and the corresponding error messages.
About This Manual LabVIEW Data Types Each VI description includes a data type picture for each control and indicator, as illustrated in the following table: Control Indicator Data Type Boolean String Signed 16-bit integer Array of signed 16-bit integers Signed 32-bit integer Array of signed 32-bit integers 32-bit floating-point number; by default, floating-point numbers are double precision Array of 32-bit floating-point numbers Path DSP Handle Cluster Array of DSP Handle Clusters Error Cluster monosp
About This Manual Related Documentation The following documentation available from National Instruments contains information that you may find helpful as you read this manual.
About This Manual Developer Toolkit The Developer Toolkit, an optional software package that you can purchase separately from National Instruments, is required for building custom libraries with the NI-DSP Interface Utilities. The Developer Toolkit contains an AT&T C compiler, assembler, linker, and documentation. With these tools, you can program AT Series DSP boards directly, using theboard flexibility to custom tailor the DSP Library.
Part 1 Getting Started with NI-DSP This part contains a brief product overview, information about the NI-DSP for LabVIEW for Windows package, and the procedure for installing the software. Product Overview The NI-DSP software package comes with a set of LabVIEW VIs that invoke the digital signal processing (DSP) board-resident high-performance functions that efficiently process large blocks of numerical data and perform numerically intensive computations.
Getting Started with NI-DSP Part 1 What Your Distribution Diskettes Should Contain The NI-DSP software package contains the NI-DSP for LabVIEW for Windows Disks (for licensed LabVIEW for Windows users). If your kit is missing any of these components, contact National Instruments. Installing NI-DSP for LabVIEW for Windows Note: NI-DSP for LabVIEW for Windows is intended for use with the standard LabVIEW for Windows software. You must install LabVIEW for Windows before installing NI-DSP.
Part 1 Getting Started with NI-DSP NIDSP is the name you specify during setup. The SETUP program prompts you for information including the drive letter and directory in which you have installed the standard LabVIEW package. The program also verifies that your hard disk has enough space to hold the NI-DSP for LabVIEW for Windows files. If you choose Custom Installation, SETUP installs only the files you specify.
Part 2 Introduction to the NI-DSP Analysis VIs This part describes how to use the NI-DSP Analysis VIs in your LabVIEW applications. This part also describes how to manage memory on the DSP board from your LabVIEW application, and how to transfer data between your LabVIEW application and the NI-DSP functions on the board. This part contains general guidelines for developing NI-DSP applications within LabVIEW.
Introduction to the NI-DSP Analysis VIs Part 2 The AT-DSP2200 can process large amounts of data, separately and distinctly from the host PC processor. The board consists not only of a signal processing chip, but also memory where data that the board processes must reside. The AT-DSP2200 does not have access to memory locations on the host PC. Therefore, you must download all data from your application programs to DSP board memory before processing it. The Interface Library, DSP.
Part 2 Introduction to the NI-DSP Analysis VIs The DSP Allocate Memory VI allocates memory buffers on the DSP board and returns a DSP Handle Cluster, which has two fields that uniquely describe this buffer–a DSP Handle and a size. Figure 1-2.
Introduction to the NI-DSP Analysis VIs Part 2 Figures 1-4 and 1-5 show how to allocate a DSP Handle Cluster of 2,048 4-byte-long elements on board 3. The board number on which the buffer is allocated is important for determining the ownership of the buffer. When making a VI call, the same DSP board on which the function is to execute must own all of the DSP Handle Clusters or an error code is returned.
Part 2 Introduction to the NI-DSP Analysis VIs Special Features of the NI-DSP Analysis VIs This section describes the special features of the NI-DSP Analysis VIs that make them different from other LabVIEW VIs. • DSP Handle Cluster in/out. The way you specify the output data buffers for NI-DSP Analysis VIs is different from the way you would specify output data buffers for other LabVIEW VIs. DSP Handle Clusters also represent all the output data buffers in the NI-DSP Analysis VIs.
Introduction to the NI-DSP Analysis VIs Part 2 The error in/error out cluster contains the following elements: The boolean value is true if an error occurred, false if no error occurred. code is the error code. source is the source of the error. If an error occurs during execution, the VI sets source to the name of the VI that produced the error. Every VI checks error in first. If there is an error, the VI does not execute any DSP code but simply passes the contents of error in to the error out cluster.
Part 2 Introduction to the NI-DSP Analysis VIs error out of the Copy Mem(LV to DSP) VI is connected to the error in of the DSP Free Memory VI error out of the DSP Add VI is connected to the error in of the Copy Mem(LV to DSP) VI Figure 1-9. An Example of Using the error in/error out Cluster for Sequential VI Execution For more information about the error in/error out cluster, refer to Chapter 2, Error Handler VIs, in the LabVIEW Utility VI Reference Manual.
Introduction to the NI-DSP Analysis VIs Part 2 An Example of Using NI-DSP Analysis VIs Figures 1-10 and 1-11 show the front panel and block diagram, respectively, of an example using NI-DSP Analysis VIs. Figure 1-10. Front Panel–An Example of Using NI-DSP Analysis VIs Figure 1-11.
Part 2 Introduction to the NI-DSP Analysis VIs This example shows you how to obtain the power spectrum of a sine wave signal. First, generate a sine wave that you want to analyze using the LabVIEW Analysis VIs, then use the Copy Mem(LV to DSP) VI to copy the data of this sine signal to the DSP board. Before you copy the data, you must call the DSP Allocate Memory VI to allocate a DSP Handle Cluster that reserves a data buffer on the DSP board.
Chapter 1 NI-DSP Analysis VI Reference Overview This chapter contains an overview of the NI-DSP Analysis VIs and includes a list of the VIs. This chapter describes how the NI-DSP Analysis VIs are organized and how to access them. The NI-DSP Analysis VI Overview The NI-DSP Analysis VIs are a set of high-performance VIs that efficiently process large blocks of numerical data and perform numerically intensive computations.
NI-DSP Analysis VI Reference Overview Chapter 1 Table 1-1.
Chapter 1 NI-DSP Analysis VI Reference Overview Table 1-1. The NI-DSP Analysis VI Groups (Continued) Utility Functions DSP Reset DSP Load DSP Start DSP Timeout DSP Custom DSP DMA Copy(DSP to LV) DSP DMA Copy(LV to DSP) DSP Handle to Address Analysis VI Organization After installation, the NI-DSP Analysis VIs reside in the following VI library files (LabVIEW .LLB files) within the DSP2200 option: • Signal Generation contains VIs that generate digital patterns.
NI-DSP Analysis VI Reference Overview Chapter 1 Figure 1-1. Choosing DSP2200 from the Functions Menu About the Fast Fourier Transform (FFT) The VIs in the Frequency Domain group are based upon the discrete implementation and optimization of the Fourier Transform integral.
Chapter 1 NI-DSP Analysis VI Reference Overview The discrete implementation of the DFT is a numerically intense process. However, it is possible to implement a fast algorithm when the size of the sequence is a power of two. These algorithms are known as FFTs, and can be found in many introductory digital signal processing (DSP) texts. The resulting complex FFT sequence has the conventional DSP format as described in this section.
NI-DSP Analysis VI Reference Overview Chapter 1 The set of coefficients a and b are often referred to as the numerator and denominator coefficients, respectively. Another common way to refer to them is as the feedforward and feedback coefficients. This is due to the mathematical derivation that led to equation a. Refer to Discrete-Time Signal Processing by Oppenheim and Schafer for more information. Another frequent assumption is that a(0)=1.0. For example, let us assume M = 4, N = 4 and n = 2.
Chapter 1 NI-DSP Analysis VI Reference Overview The simplest window is a rectangular window. Because this window requires no special effort it is commonly referred to as the no window option. Remember, however, that a discrete signal and its spectrum is always affected by a window. Let x[n] be a digitized time-domain waveform that has a finite length of n. w[n] is a window sequence of n points.
NI-DSP Analysis VI Reference Overview Chapter 1 Window definitions used in National Instruments analysis libraries are designed in such a way that the window operations in the time domain are exactly equivalent to the operations of the same window in the frequency domain. To meet this requirement, the windows are not symmetrical in the time domain, that is: w[0] ≠ w[N-1] (3) where N is the window length. They are usually symmetrical in the frequency domain, however.
Chapter 2 NI-DSP Analysis VI Reference This chapter contains a brief explanation of each NI-DSP Analysis VI . The VIs are arranged alphabetically. Copy Mem(DSP to DSP) Copies a buffer of data from the Source buffer on the DSP board that is referred to by a DSP Handle Cluster to the destination buffer on the DSP board, which is referred to by another DSP Handle Cluster. Source and destination buffers should be on the same DSP board.
NI-DSP Analysis VI Reference Chapter 2 Copy Mem(DSP to LV) Copies an entire or partial buffer of data according to the entire/partial copy selector from the Source buffer on the DSP board that is referred to by a DSP Handle Cluster to the destination buffer in LabVIEW. To copy data correctly from the DSP board to LabVIEW, you must indicate what type of data is stored in the Source buffer on the DSP board.
NI-DSP Analysis VI Reference Chapter 2 Copy Mem(LV to DSP) Copies a buffer of data from the source buffer in LabVIEW to the destination buffer on the DSP board, which is referred to by a DSP Handle Cluster. The source buffer can contain one of three kinds of data–float (32-bit), short (16-bit), and long (32-bit). To copy different types of data, you must wire to the appropriate source terminal. You must wire only one kind of source terminal.
Chapter 2 NI-DSP Analysis VI Reference DSP Absolute Find the absolute value of input array X. The ith element of the output array Y is obtained using the following formula: Y(i) = |X(i) |. for i = 0, 1, 2, … , n-1 where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. Y in is a DSP Handle Cluster that indicates the memory buffer on the DSP board that will contain the absolute results of X(i).
NI-DSP Analysis VI Reference Chapter 2 DSP Add Add array X to array Y. The ith element of the output array Z is obtained using the following formula: Z(i) = X(i) + Y(i). for i = 0, 1, 2, … , n-1 where n is the smaller number of elements in X and Y. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. Y is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array Y.
Chapter 2 NI-DSP Analysis VI Reference DSP Allocate Memory Allocates a block of memory buffer on the DSP board specified by slot and returns a DSP Handle Cluster that contains the coded DSP board memory and the number of elements in this buffer. The number of bytes allocated for this buffer depends on size and bytes/element selector. If bytes/element selector selects 4 bytes, then the number of bytes = size*4. If bytes/element selector selects 2 bytes, then the number of bytes = size*2.
NI-DSP Analysis VI Reference Chapter 2 DSP Blackman Window Applies a Blackman window to the input sequence X. If Y represents the output sequence Blackman{X}, the elements of Y are obtained from the following formula: yi = xi [0.42 - 0.50 cos(w) + 0.08 cos(2w)] for i = 0, 1, 2, … , n-1 , w = 2πi , n where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
Chapter 2 NI-DSP Analysis VI Reference DSP Blackman Harris Window Applies a Blackman Harris window to the input sequence X. If Y represents the output sequence Blackman Harris{X}, the elements of Y are obtained using the following formula: yi = xi [0.42323 - 0.49755 cos(w) +0.07922 cos(2w)] for i = 0, 1, 2, … , n-1 w = 2πi , n where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
NI-DSP Analysis VI Reference Chapter 2 DSP Butterworth Coefficients Generates the set of filter coefficients to implement an IIR filter as specified by the Butterworth filter model. You can then pass these coefficients to the DSP IIR Filter VI to filter a sequence of data. filter type specifies the passband of the filter. It has four options: 0: lowpass. 1: highpass. 2: bandpass. 3: bandstop. filter type defaults to lowpass. sampling freq : fs is the sampling frequency and must be greater than 0.
Chapter 2 NI-DSP Analysis VI Reference Parameter Discussion The arrays Forward Coefficients in/out and Feedback Coefficients in/out must have a size of at least (order + 1) for lowpass and highpass filters. The arrays Forward Coefficients in/out and Feedback Coefficients in/out must have a size of at least (2*order + 1) for bandpass and bandstop filters. DSP Chebyshev Coefficients Generates the set of filter coefficients to implement an IIR filter as specified by the Chebyshev filter model.
Chapter 2 NI-DSP Analysis VI Reference Feedback Coefficients out is a DSP Handle Cluster that is identical to the Feedback Coefficients in, but with the feedback coefficients already stored in the memory buffer on the DSP board. error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call.
NI-DSP Analysis VI Reference Chapter 2 DSP Complex FFT Computes the Fast Fourier transform of the complex input sequence X. If Y represents the complex output sequence, then: Y = F{X}. Re{X} is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the real part of the input signal array X. Im{X} is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the imaginary part of input signal array X.
Chapter 2 NI-DSP Analysis VI Reference DSP Convolution Computes the convolution of the input sequences X and Y. The convolution Cxy(t), of the signals x(t) and y(t), is defined as follows: ∞ Cxy(t) = x(t) * y(t) = ∫ x(τ) y(t-τ) dτ , -∞ where the symbol * denotes convolution. For the discrete implementation of the convolution, let Cxy represent the output sequence X * Y, n be the number of elements in the input sequence X, and m be the number of elements in the input sequence Y.
NI-DSP Analysis VI Reference Chapter 2 DSP Correlation Computes the cross correlation of the input sequences X and Y. The cross correlation Rxy(t) of the signals x(t) and y(t) is defined as follows: ∞ R xy(t) = x(t) ⊗ y(t) = ∫ x(t) y(t+t) dt , -∞ where the symbol ⊗ denotes correlation. For the discrete implementation of the correlation, let Rxy represent the output sequence X ⊗ Y, n be the number of elements in the input sequence X, and m be the number of elements in the input sequence Y.
Chapter 2 NI-DSP Analysis VI Reference DSP Cross Power Computes the cross power spectrum of the input sequences X and Y. The cross power, Sxy(f), of the signals x(t) and y(t) is defined as follows: S xy(f) = X*(f)Y(f) where X*(f) is the complex conjugate of X(f), X(f) = F{x(t)}, and Y(f) = F{y(t)}.
NI-DSP Analysis VI Reference Chapter 2 DSP Custom Use this VI as the interface to call your own custom functions written on the DSP board from LabVIEW. For more details about how to use this VI, refer to Part 4, NI-DSP Interface Utilities, of this manual. slot is the board ID number. slot defaults to 3. function code indicates which function on the DSP board LabVIEW is calling. function code defaults to 0.
Chapter 2 NI-DSP Analysis VI Reference DSP Decimate Decimates the input sequence X by the decimating factor and the averaging control.
NI-DSP Analysis VI Reference Chapter 2 DSP Deconvolution Computes the deconvolution of the input sequences X and Y. The convolution operation can be realized using Fourier identities because x(t) * y(t) ⇔ X(f) Y(f) is a Fourier transform pair, where the symbol * denotes convolution, and the deconvolution is the inverse of the convolution operation.
Chapter 2 NI-DSP Analysis VI Reference DSP Derivative Performs a discrete differentiation of the sampled signal X. The differentiation f(t) of a function F(t) is defined as follows: f(t) = d F(t). dt Let Y represent the sampled output sequence d/dt X. The discrete implementation is given by the following formula: yi = 1 (x - x ) 2dt i+1 i-1 for i = 0, 1, 2, …, n-1.
NI-DSP Analysis VI Reference Chapter 2 DSP Divide Divide array X by array Y. The ith element of the output array Z is obtained using the following formula: Z(i) = X(i) / Y(i). for i = 0, 1, 2, …, n-1. where n is the smaller number of elements in X and Y. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. Y is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array Y.
Chapter 2 NI-DSP Analysis VI Reference DSP Elliptic Coefficients Generates the set of filter coefficients to implement a digital elliptic IIR filter. You can then pass these coefficients to the DSP IIR Filter VI. filter type specifies the passband of the filter. filter type has four options: 0: lowpass. 1: highpass. 2: bandpass. 3: bandstop. filter type defaults to lowpass. sampling freq : fs is the sampling frequency and must be greater than 0.
NI-DSP Analysis VI Reference Chapter 2 error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call. Parameter Discussion The arrays Forward Coefficients in/out and Feedback Coefficients in/out must have a size of at least (order + 1) for lowpass and highpass filters.
Chapter 2 NI-DSP Analysis VI Reference DSP Equi-Ripple BandPass Generates a bandpass FIR filter with equi-ripple characteristics using the Parks-McClellan algorithm and the number of taps, lower stop frequency, higher stop frequency, lower pass frequency, higher pass frequency, and sampling frequency. The VI then filters the input sequence X to obtain the bandpass filtered linearphase sequence Filtered Data. The first stopband of the filter region goes from zero (DC) to the lower stop frequency.
NI-DSP Analysis VI Reference Chapter 2 A delay is also associated with the output sequence delay = m-1 . 2 error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call. The operation cannot be performed in place; that is, the input X and the output Filtered Data cannot be the same DSP Handle Cluster.
Chapter 2 NI-DSP Analysis VI Reference DSP Equi-Ripple BandStop Generates a bandstop FIR digital filter with equi-ripple characteristics using the Parks-McClellan algorithm and number of taps, lower pass frequency, higher pass frequency, lower stop frequency, higher stop frequency, and sampling frequency. The VI then filters the input sequence X to obtain the bandstop filtered linear-phase sequence Filtered Data. The first passband region of the filter goes from zero (DC) to the lower pass frequency.
NI-DSP Analysis VI Reference Chapter 2 A delay is also associated with the output sequence: delay = m-1 . 2 error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call. The operation cannot be performed in place; that is, the input X and the output Filtered Data cannot be the same DSP Handle Cluster.
Chapter 2 NI-DSP Analysis VI Reference DSP Equi-Ripple HighPass Generates a highpass FIR filter with equi-ripple characteristics using the Parks-McClellan algorithm and the number of taps, high frequency, stop frequency, and sampling frequency. The VI then filters the input sequence X to obtain the highpass filtered linear-phase sequence Filtered Data. The stopband of the filter goes from zero (DC) to the stop frequency.
NI-DSP Analysis VI Reference Chapter 2 error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call. The operation cannot be performed in place; that is, the input X and the output Filtered Data out cannot be the same DSP Handle Cluster.
Chapter 2 NI-DSP Analysis VI Reference DSP Equi-Ripple LowPass Generates a lowpass FIR filter with equiripple characteristics using the ParksMcClellan algorithm and the number of taps, pass frequency, stop frequency, and sampling frequency. The VI then filters the input sequence X to obtain the lowpass filtered linear-phase sequence Filtered Data. The passband of the filter goes from zero (DC) to pass freq.
NI-DSP Analysis VI Reference Chapter 2 DSP Exact Blackman Window Applies an Exact Blackman window to the input sequence X. If Y represents the output sequence Exact Blackman{X}, the elements of Y are obtained using the formula: yi = xi [0.42659071 - 0.49656062 cos(w) + 0.07684867 cos(2w)] for i = 0, 1, 2, … , n-1 w = 2πi , n where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
Chapter 2 NI-DSP Analysis VI Reference DSP Exponential Window Applies an exponential window to the input sequence X. If Y represents the output sequence Exponential{X}, the elements of Y are obtained using the formula: yi = xi exp(a * i) for i = 0, 1, 2, … , n-1, a= ln |f| , n-1 where f is the final value, and n is the number of elements in X. You can use the Exponential Window VI to analyze transients.
NI-DSP Analysis VI Reference Chapter 2 DSP FHT Computes the fast Hartley transform (FHT) of the input sequence X. The Hartley transform of a function x(t) is defined as follows: ∞ X(f) = ∫ x(t) cas(2πft) dt -∞ where cas(x) = cos(x) + sin(x). If Y represents the output sequence FHT {X} obtained via the FHT, then Y is obtained through the discrete implementation of the Hartley integral: ∑ X cas ( n-1 Yk = i i=0 ), 2π ik n for k = 0, 1, 2, … , n-1 . where n is the number of elements in X.
Chapter 2 NI-DSP Analysis VI Reference DSP Flat Top Window Applies a flat top window to the input sequence X. If Y represents the output sequence Flattop{X}, the elements of Y are obtained using the formula: yi = xi [0.2810639 - 0.5208972 cos(w) + 0.1980399 cos(2w)] for i = 0, 1, 2, … , n-1 w = 2πi , n where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
NI-DSP Analysis VI Reference Chapter 2 DSP Force Window Applies a force window to the input sequence X If Y represents the output sequence Force{X}, the elements of Y are obtained using the formula: xi if 0 ≤ i ≤ d 0 elsewhere yi = for i = 0, 1, 2, …, n-1 , d = (0.01)(n)(duty) where n is the number of elements in X. You can use the Force Window VI to analyze transients. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
Chapter 2 NI-DSP Analysis VI Reference DSP Gaussian White Noise Generates a Gaussian distributed pseudorandom pattern whose statistical profile is as follows: (µ, σ) = (0, s) , where s is the absolute value of the specified standard deviation. standard deviation defaults to 1.0. seed < 65536.0. If seed > 0.0, the generated noise will be the same in repeated invocations if the seed value does not change. If seed ≤ 0.
NI-DSP Analysis VI Reference Chapter 2 DSP General Cosine Window Applies a general cosine window to the input sequence X. If A represents the Cosine Coefficients input sequence and Y represents the output sequence GenCos{X}, the elements of Y are obtained using the formula: yi = xi m-1 ∑ (-1)k ak cos (kw) k=0 for i = 0, 1, 2, … , n-1 w = 2πi , n where n is the number of elements in X, and m is the number of elements in Cosine Coefficients.
Chapter 2 NI-DSP Analysis VI Reference DSP Hamming Window Applies a Hamming window to the input sequence X. If Y represents the output sequence Hamming {X}, the elements of Y are obtained from the formula: yi = x i [0.54 - 0.46 cos(w)] for i = 0, 1, 2, …, n-1 , w = 2πi , n where n is the number of elements in the input sequence X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input data array.
NI-DSP Analysis VI Reference Chapter 2 DSP Handle To Address Finds the actual DSP address value of DSP Handle Cluster that indicates a memory buffer on the DSP board. You can use the output DSP Address as the input of the DSP Address terminal in the DSP DMA Copy(DSP to LV) VI or the DSP DMA Copy(LV to DSP) VI. DSP Handle Cluster indicates a memory buffer on the DSP board. DSP Address is the actual DSP address of the memory buffer on the DSP board referred to by DSP Handle Cluster.
Chapter 2 NI-DSP Analysis VI Reference DSP Hanning Window Applies a Hanning window to the input sequence X. If Y represents the output sequence Hanning {X}, the elements of Y are obtained using the formula: yi = 0.5 xi [1 - cos(w)] for i = 0, 1, 2, …, n-1 , w = 2πi , n where n is the number of elements in the input sequence X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input data array.
NI-DSP Analysis VI Reference Chapter 2 DSP IIR Filter Performs IIR filtering on the X input array and reports the result in Y. It uses the arrays a and b of sizes sza and szb respectively in implementing the linear difference equation that describes IIR filtering: k = sza - 1 k = szb-1 y[i] = ∑ a(k) * x(i-k) - ∑ b(k) * y(i-k) k=0 k=1 i = 0,1 .....
Chapter 2 NI-DSP Analysis VI Reference Y out is a DSP Handle Cluster that is identical to Y in, but with the filtered data already stored in the memory buffer on the DSP board. Final Conditions on input is a DSP Handle Cluster that is identical to Initial Conditions on input, but contains the final conditions on input. Final Conditions on output is a DSP Handle Cluster that is identical to Initial Conditions on output, but contains the final conditions on output.
NI-DSP Analysis VI Reference Chapter 2 DSP Impulse Pattern Generates an array containing an impulse pattern. If the Impulse Pattern is represented by the sequence X, the VI generates the pattern according to the following formula: xi = a if i = d 0 elsewhere for i = 0, 1, 2, … , n-1 , where a is the amplitude, d is the delay, and n is the number of elements in Impulse Pattern. amplitude defaults to 1.0. delay must be greater than or equal to 0.
Chapter 2 NI-DSP Analysis VI Reference DSP Impulse Train Pattern Generates a train of impulses of value amplitude at sample delay. If the impulse train pattern is represented by the sequence X, the VI generates the pattern according to the following formula: xi = amplitude if i modulo P = d 0.0 elsewhere for i = 0, 1, 2, … , n-1 , where P is the period, d is the delay, and n is the number of elements in the impulse train. amplitude defaults to 1.0. delay defaults to 0. period defaults to 1.
NI-DSP Analysis VI Reference Chapter 2 DSP Index Memory Indexes into a DSP buffer allocated in the memory space of the specified DSP board. The return value is another DSP Handle Cluster. This VI does not allocate memory. In order to index into a buffer correctly, you need to indicate what type of data is in the DSP buffer. You must set data type to the appropriate type. data type has two options–4 bytes (for 32-bit long and floating-point data) and 2 bytes (for 16-bit short data).
Chapter 2 NI-DSP Analysis VI Reference DSP Init Memory Initializes the memory heaps and frees all allocations of memory on the specified DSP board. slot is the board ID number. slot defaults to 3. error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call.
NI-DSP Analysis VI Reference Chapter 2 DSP Integral Performs the discrete integration of the sampled signal X. The integral F(t) of a function f(t) is defined as follows: F(t) = ∫ f(t) dt . Let Y represent the sampled output sequence Integral X.
Chapter 2 NI-DSP Analysis VI Reference DSP Inv Chebyshev Coeff Generates the set of filter coefficients to implement an inverse IIR filter as specified by the Chebyshev II Filter mode. You can then pass these coefficients to the DSP IIR Filter VI to filter a sequence of data. filter type specifies the passband of the filter. filter type has four options: 0: lowpass. 1: highpass. 2: bandpass. 3: bandstop. filter type defaults to lowpass.
NI-DSP Analysis VI Reference Chapter 2 error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call. Parameter Discussion The arrays Forward Coefficients in/out and Feedback Coefficients in/out must have a size of at least (order + 1) for lowpass and highpass filters.
Chapter 2 NI-DSP Analysis VI Reference DSP Inverse FHT Computes the inverse fast Hartley transform of the input sequence FHT {X}. The inverse Hartley transform of a function X(f) is defined as ∞ x(t) = ∫ X(f) cas(2πft) df -∞ where cas(x) = cos(x) + sin(x). If Y represents the output sequence X, the VI calculates Y through the discrete implementation of the inverse Hartley integral: ∑ X cas ( n-1 1 Yk = n i i=0 ) 2π ik n for k = 0, 1, 2, … , n-1 where n is the number of elements in X.
NI-DSP Analysis VI Reference Chapter 2 DSP Kaiser-Bessel Window Applies a Kaiser-Bessel window to the input sequence X. If Y represents the output sequence Kaiser-Bessel{X}, the elements of Y are obtained using the formula: I o β 1. 0 - a 2 I o (β ) yi = x i for i = 0, 1, 2, … n - 1 a = i-k k k = n-1 , 2 where n is the number of elements in X, and Io(•) is the zeroth-order modified Bessel function.
Chapter 2 NI-DSP Analysis VI Reference DSP Linear Evaluation Performs a linear evaluation of the input array X. The ith element of the output array Y is obtained using the following formula: Y(i) = a* X(i) + b for i = 0, 1, 2, …, n-1, where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. a is the multiplicative constant. a defaults to 1.0. b is the additive constant. b defaults to 0.0.
NI-DSP Analysis VI Reference Chapter 2 DSP Log Computes the logarithm base 10 of the X input array. The ith element of resulting array is obtained by using the following formula: y(i) = log10 (X(i)) * mult for i = 0, 1, 2, …, n-1, where n is the number of elements in X. This VI is useful for converting values that represent power to decibels. This VI returns the most negative number for any input less than or equal to zero.
Chapter 2 NI-DSP Analysis VI Reference DSP Max & Min Finds the maximum and minimum values in the input array, as well as the respective indices of the occurrence of the maximum and minimum values. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. max value is the maximum value of the input array. max index is the index into the input array where maximum occurred. min value is the minimum value of the input array.
NI-DSP Analysis VI Reference Chapter 2 DSP Median Filter Applies a median filter of rank to the input sequence X. The median filter is a nonlinear filter that combines lowpass filters characteristics (to remove highfrequency noise) and high-frequency characteristics (to detect edges).
Chapter 2 NI-DSP Analysis VI Reference DSP Multiply Multiply array X by array Y. The ith element of the output array Z is obtained using the following formula: Z(i) = X(i) * Y(i) for i = 0, 1, 2, …, n-1, where n is the smaller number of elements in X and Y. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. Y is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array Y.
NI-DSP Analysis VI Reference Chapter 2 DSP Parks-McClellan Generates a set of linear-phase finite impulse response multiband digital filter coefficients using the number of taps, sampling frequency, filter type, and Band Parameters. # of taps is the total number of coefficients in H. A tap corresponds to a multiplication and an addition. If there are n taps, every filtered sample requires n multiplications and n additions. # of taps must be greater than 0.
Chapter 2 NI-DSP Analysis VI Reference weighted ripple is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the weighting factor for each band.
NI-DSP Analysis VI Reference Chapter 2 The equi-ripple filters use a similar technique to filter the data.
Chapter 2 NI-DSP Analysis VI Reference Parameter Discussion The weights are usually the same for every band and inversely proportional to frequency f for a differentiate. The amplitudes of the bands are usually the same for every band and form a slope for a differentiation. The designed filter is unconstrained, that is the frequency response in transitional period specifications is not guaranteed. Adjust the parameters if there are discrepancies between specifications and results.
NI-DSP Analysis VI Reference Chapter 2 DSP Polar to Rectangular Converts a set of polar coordinate points (Magnitude, Phase) to a set of rectangular coordinate points (X, Y). The i th elements of the rectangular set is obtained using the following formulas: X(i) = Magnitude(i) * cos(Phase(i)) Y(i) = Magnitude(i) * sin(Phase(i)) Note: The operation is performed in place and the input arrays Magnitude and Phase are overwritten by X and Y.
Chapter 2 NI-DSP Analysis VI Reference DSP Polynomial Evaluation Performs a polynomial evaluation on the input array X. The i th element of the output array Y is obtained using the following formula: k-1 Y(i) = ∑ (Coefficients(j) * X(i)j) j=0 for i = 0, 1, 2, …, n-1, where n is the number of elements in X and k is the number of elements in Coefficients. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X.
Chapter 2 NI-DSP Analysis VI Reference DSP Power Spectrum Computes the Power Spectrum of the input sequence X. The Power Spectrum S xx(f) of a function x(t) is defined as S xx(f) = X*(f)X(f) = | X(f) | 2 , where X(f) = F{x(t)}, and X*(f) is the complex conjugate of X(f). X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array. Notes: The number of elements for the input array must be a power of two.
NI-DSP Analysis VI Reference Chapter 2 DSP Pulse Pattern Generates an array containing a pulse pattern. If Pulse Pattern is represented by the sequence X, then the pattern is generated according to the following formula: xi = a if d ≤ i < last 0 elsewhere for i = 0, 1, 2, … , n-1 , last = d + w , where a is the amplitude, d is the delay, w is the width, and n is the number of elements in Pulse Pattern. amplitude defaults to 1.0. delay must be greater than or equal to 0. delay defaults to 0.
Chapter 2 NI-DSP Analysis VI Reference DSP Ramp Pattern Generates an array containing a ramp pattern. If the Ramp Pattern is represented by the sequence X, then the pattern is generated according to the formula: xi = x0 + i ∆x for i = 0, 1, 2, … , n-1 , xn-1 - x0 , n-1 xn-1 is the final, x0 is the init, and n is the number of elements in Ramp Pattern. where ∆x = The Ramp Pattern VI does not impose conditions on the relationship between init and final.
NI-DSP Analysis VI Reference Chapter 2 DSP Random Pattern Generates a uniformly distributed pseudorandom pattern whose values are in the range [0:1]. The sequence is generated using the Very-Long-Cycle random number generator algorithm. seed < 65536.0. If seed > 0.0, the generated noise will be the same in repeated invocations if the seed value does not change. If seed ≤ 0.
Chapter 2 NI-DSP Analysis VI Reference DSP Rectangular To Polar Converts a set of rectangular coordinate points (X, Y) to a set of polar coordinate points (Magnitude, Phase). The i th element of the polar coordinate set is obtained by using the following fomulas: 2 2 Magnitude(i) = X(i) + Y(i) Phase(i) = arctan(Y(i)/X(i)) Note: The operation is perfomed in place and the input arrays X and Y are overwritten by Magnitude and Phase.
NI-DSP Analysis VI Reference Chapter 2 DSP ReFFT Computes the Fast Fourier transform of a real input sequence X. If Y represents the complex output sequence, then: Y = F{X}. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array. Notes: The number of elements for input X must be the power of two. The operation is performed in place and the input array X is overwritten by Re FFT{X}.
Chapter 2 NI-DSP Analysis VI Reference DSP Reverse Reverse the order of the elements of the input array X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. The operation can only be performed in place; that is, the input X is overwritten by the output Reverse {X}. Reverse {X} is a DSP Handle Cluster that is identical to the X, but with the reverse {X} already stored in the memory buffer on the DSP board.
NI-DSP Analysis VI Reference Chapter 2 DSP Sawtooth Pattern Generate a sawtooth pattern with positive-slope, zero-crossing at sample delay. If the sawtooth pattern is represented by the sequence Y, then the pattern is generated according to the following formula: 2aT k yi = 2aT (k -T) if 0 ≤ k < T 2 for i = 0, 1, 2, ..., n - 1 T if ≤ k < T 2 where k = (i - d) modulo T and T= n , cycles d is the delay, and n is the number of elements in the sawtooth pattern. amplitude defaults to 1.0.
Chapter 2 NI-DSP Analysis VI Reference DSP Set Set the elements of the input array X to the constant value set value. If the output Set {X} is represented by the sequence Y, then: yi = set value for i = 0, 1, 2, …, n-1 , where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. The operation is performed in place; that is, the input X is overwritten by the output Set {X}. set value defaults to 0.0.
NI-DSP Analysis VI Reference Chapter 2 DSP Sinc Pattern Generates an array containing a sinc pattern. If the Sinc Pattern is represented by the sequence Y, then the pattern is generated according to the following formula: yi = a sinc(i∆ t - d) , for i = 0, 1, 2, …, n-1 , where sinc(x) = sin(πx) , πx a is the amplitude, ∆t is the sampling interval delta t, d is the delay, and n is the number of elements in Sinc Pattern.
Chapter 2 NI-DSP Analysis VI Reference DSP Sine Pattern Generates an array containing a sinusoidal pattern. If the Sine Pattern is represented by the sequence Y, the pattern is generated according to the following formula: yi = a sin(x i) , for i = 0, 1, 2, …, n-1 , where xi = 2πi k π øo + , n 180 a is the amplitude, k is the number of cycles in the pattern, øo is the initial phase in degrees, and n is the number of elements in Sine Pattern. amplitude defaults to 1.0. phase defaults to 0.0.
NI-DSP Analysis VI Reference Chapter 2 DSP Square Pattern Generates an array containing a square pattern. If the Square Pattern is represented by the sequence X, then the pattern is generated according to the following formula: a if 0 ≤ remainder i < 0.01 dT T xi = for i = 0, 1, …, n-1 , 0.0 elsewhere () n is the time period of one cycle of the Square Pattern, cycles a is the amplitude, d is the duty cycle in percent, and n is the number of elements in Square Pattern.
Chapter 2 NI-DSP Analysis VI Reference DSP Square Root Find a square root estimate of the absolute value of each element of the input array X . The ith element of the output array Y is obtained using the following formula: Y(i) = | X(i)| for i = 0, 1, 2, …, n-1 , where n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X.
NI-DSP Analysis VI Reference Chapter 2 DSP Sort Sort the input array X in ascending or descending order. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. direction is the direction to sort: 0: ascending. 1: descending. direction defaults to ascending. Sorted {X} in is a DSP Handle Cluster that indicates the memory buffer on the DSP board that will contain the output array of sorted {X}.
Chapter 2 NI-DSP Analysis VI Reference DSP Start Enables the DSP board to run. Use DSP Start with the DSP Load and DSP Reset VIs after downloading a custom application. slot is the board ID number. slot defaults to 3. error in (no error) contains the error information from a previous VI. If an error occurs, it is passed out error out and no other calls are made. error out contains the error information for this call.
NI-DSP Analysis VI Reference Chapter 2 DSP Subtract Subtract array Y from array X. The ith element of the output array Z is obtained using the following formula: Z(i) = X(i) -Y(i). for i = 0, 1, 2, …, n-1 , where n is the smaller number of elements in X and Y. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array X. Y is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array Y.
Chapter 2 NI-DSP Analysis VI Reference DSP TimeOut Selects the timeout limit in seconds to wait for a function on DSP board to complete execution. The default timeout setting at startup and after a DSP Reset call is 10 s. All subsequent calls from the VI to the onboard functions on the specified board return timeout errors if function execution on the board calling the VI is not completed in the timeout limit. slot is the board ID number. slot defaults to 3. timeout is the timeout in seconds.
NI-DSP Analysis VI Reference Chapter 2 DSP Triangle Pattern Generates an array containing a triangle pattern. If the Triangle Pattern is represented by the sequence Y, the pattern is generated according to the following formula: yi = a tri (xi) , for i = 0, 1, 2, …, n-1 , where xi = i∆t - d , and w tri(x) = 1 - | x | 0 if | x | ≤ 1 elsewhere a is the amplitude, d is the delay, w is the width, and n is the number of elements in Triangle Pattern.
Chapter 2 NI-DSP Analysis VI Reference Amplitude 0 0 Delay (s) Width (s) delta t (s) The following figure illustrates how the pattern can vary with different values for the parameters. Delay = 0 Delay = delta t 0 0 Width (s) delta t (s) delta t (s) Notice that when the Delay is 0, the signal is a ramp with a slope of -Amplitude/Width, and when Delay equals delta t, the signal is a ramp with a slope of Amplitude/Width.
NI-DSP Analysis VI Reference Chapter 2 DSP Triangular Train Generates a train of triangular pattern crossing value zero at delay with positive slope. If the triangular train is represented by the sequence Y, the pattern is generated according to the following formula: 4aT k - 4a T y = T (k- 2 ) 4a T (k- T) i if 0 ≤ k ≤ T 4 if T 3T ≤k≤ 4 4 if 3T ≤k
Chapter 2 NI-DSP Analysis VI Reference DSP Triangular Window Applies a triangular window to the input sequence X. If Y represents the output sequence Triangle{X}, the elements of Y are obtained from the formula: yi = xi tri(w) for i = 0, 1, 2, …, n-1 , w = 2i-n , n where tri(w) = 1 - |w|, and n is the number of elements in X. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array.
NI-DSP Analysis VI Reference Chapter 2 DSP Uniform White Noise Generates a uniformly distributed pseudorandom pattern whose values are in the range [-a:a], where a is the absolute value of amplitude. The pseudorandom sequence is generated using a modified version of the Very-Long-Cycle random number generator algorithm. amplitude defaults to 1.0. seed < 65536.0. If seed > 0.0, the generated noise will be the same in repeated invocations if the seed value does not change. If seed ≤ 0.
Chapter 2 NI-DSP Analysis VI Reference DSP Unwrap Phase Unwraps the Phase array by eliminating discontinuities whose absolute values exceed π. X is a DSP Handle Cluster that indicates the memory buffer on the DSP board that contains the input signal array. Y in is a DSP Handle Cluster that indicates the memory buffer on the DSP board that will contain the results of the integration of X.
NI-DSP Analysis VI Reference Chapter 2 DSP Zero Padder Pads the input array with zero from starting index to the end of the input array. This VI is useful when the size of the acquired data buffers is not a power of two and you want to take advantage of fast processing algorithms in the analysis VIs. These algorithms include Fourier transforms, power spectrum, and fast Hartley transforms, which are extremely efficient for buffer sizes that are a power of two.
Chapter 1 Introduction to the NI-DSP Interface Utilities This chapter contains an overview of the NI-DSP Interface Utilities, installation instructions, and explains how to use the NI-DSP Interface Utilities. You should familiarize yourself with the material in this chapter before beginning subsequent chapters in this part.
Introduction to the NI-DSP Interface Utilities Chapter 1 The Examples directory contains the files used in Part 4, Chapter 2, Getting Started with the NI-DSP Interface Utilities, to build a custom DSP Library. The LIB directory contains LIBLVDSP.a, the archived library of object modules containing all of the analysis functions and Kernel routines used in building the downloadable DSP Library files, as well as the two DSP Library files LV2200S.out and LV2200.out.
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.
Getting Started with the NI-DSP Interface Utilities Chapter 2 long *n,*imin,*imax; { long i,j; float *x, small; float localmin ,localmax; if ((*n)<= 0) return(0); x = z; localmin = *x; localmax = localmin; *imax = 0; *imin = 0; for (i=0;i< *n;i++,*x++) { if (localmax < *x) { localmax = *x; *imax = i; } if (localmin > *x) { localmin = *x; *imin = i; } } *min = localmin; *max = localmax; for(i=0; i< *n; i++) y[i] = z[i]; for(i=0; i< *n; i++){ for(j=i+1; j< *n; j++) if(y[i] > y[j]) { small = y[j]; y[j] = y[i
Chapter 2 • Getting Started with the NI-DSP Interface Utilities Parameters must be 32-bit floating-point, 32-bit integer scalars, or pointers to arrays of data (any type)– Supported parameter types are 32-bit floating-point scalars and multidimensional arrays, and 32-bit integer scalars and multidimensional arrays.
Getting Started with the NI-DSP Interface Utilities Chapter 2 • Return a 16-bit short integer error code–Every function should return an integer error code. A list of error codes that the existing DSP Library returns is given in Appendix A, Error Codes. If any of these error codes are used, ATDSP.h should be included at the beginning of your source code. A function that completes with no error should return noError or zero.
Chapter 2 Getting Started with the NI-DSP Interface Utilities 2. Compile and/or Assemble Source Code Compile all new C source files and assemble all new assembly source files using the WE DSP32C C compiler and assembler. Remember to use only float and long data types for scalars. If you use any of the error codes from Appendix A, Error Codes, include ATDSP.h at the beginning of your source code. A function that completes with no error should return noError or zero. The ATDSP.
Getting Started with the NI-DSP Interface Utilities Chapter 2 Notice that functions accepted by the Dispatch application should have acceptable C syntax, that is, names may contain letters, numbers, and the underscore character but must start with a letter or underscore. A function name can contain up to 31 characters. You must divide your functions into groups with a maximum of 64 (40 hex) functions per group.
Chapter 2 Getting Started with the NI-DSP Interface Utilities 5. Run the Build Dispatch Application to Generate an Assembly Dispatch File The next step is to generate an assembly dispatch file. In the current directory, run dispatch.exe. You can find the executable file under the dispatch directory. The Dispatch application automatically generates the WE DSP32C assembly code file dispatch.s and a header file dspfncs.h in your current directory. The dspfncs.
Getting Started with the NI-DSP Interface Utilities Chapter 2 6. Compile, Assemble, and Link Your Custom Library The last step in building a custom DSP Library is to compile, assemble, and link your custom library using the WE DSP32C tools. You must have installed those tools as described in the WE DSP32C Support Software Library User Manual. You must copy the file LIBLVDSP.
Chapter 2 Getting Started with the NI-DSP Interface Utilities The makelib.bat batch file performs the following: 1. makelib.bat assembles the file stackbld.s in the current directory using the AT&T d3as.exe assembler. You need to assemble this file because it includes the file stackbld.s, created by the Dispatch program, and contains the assembly code that determines which function the DSP board executes. The file dispatch.
Getting Started with the NI-DSP Interface Utilities Chapter 2 The array of DSP Handle Clusters holds all the references to arrays of data used by the custom DSP functions. You should bundle the DSP Handle Clusters together to an array in the order they appear in the first group of parameters in the custom function on the DSP board.
Getting Started with the NI-DSP Interface Utilities Chapter 2 2. Call the Custom VI After you bundle all of the parameters to arrays, connect each array to the corresponding terminals of the Custom VI. Figure 2-7 shows how to connect to the Custom VI for the gmaxmin.c. Figure 2-7. How to Connect to Custom VI to Call gmaxmin.c If your custom function does not have a certain type of parameter, leave the corresponding terminal unwired.
Chapter 2 Getting Started with the NI-DSP Interface Utilities Figure 2-8. Block Diagram–How to Index the Output Arrays of the Custom VI to Obtain Results of gmaxmin.c Figure 2-9 shows the whole block diagram that uses the Custom VI to call the custom function gmaxmin.c on the DSP board from LabVIEW. Figure 2-10 shows the front panel of the block diagram shown in Figure 2-9. Figure 2-9. Block Diagram–Using the Custom VI to Call gmaxmin.
Getting Started with the NI-DSP Interface Utilities Chapter 2 Figure 2-10. Front Panel–Using the Custom VI to Call gmaxmin.c on the DSP Board from LabVIEW At this point, finish creating the VI interface to call your custom function on the DSP board from LabVIEW. You can customize this VI as a subVI using the method described in the LabVIEW User Manual if you want to use this VI from your other applications in LabVIEW. Executing the Custom Function from LabVIEW Run this VI from LabVIEW.
Chapter 3 DSP Board Function Overview This chapter contains an overview of the prototypes of the C-callable NI-DSP Analysis functions on the DSP board that you can use in your custom programs. Every NI-DSP Analysis VI calls a function on the DSP board. When you write your own custom functions, you can call these functions from your program. These C functions include numerical analysis, signal generation, digital signal processing, digital filtering, windowing, and memory management.
DSP Board Function Overview Chapter 3 Time Domain short DSP_Convolution (float * x, long n, float * y, long m, float * cxy) short DSP_Correlation (float * x, long n, float * y, long m, float * rxy) short DSP_Decimate (float * x, long n, long decFact, long ave, float * y) short DSP_Deconvolution (float * cxy, long n, float * y, long m, float * x) short DSP_Difference (float * x, long n, float dt, float xInit, float xFinal, float * y) short DSP_Integrate (float * x, long n, float dt, float xInit, float xFin
Chapter 3 DSP Board Function Overview short short short short short short DSP_Sqrt (float * x, long n, float * y) DSP_Sub (float * x, float * y, long n, flaot * z) DSP_Subset (float * x, long n, long index, long length, float * y) DSP_Sum (float * x, long n, float * sum) DSP_Unwrap (float * x, long n, float * y) DSP_To Polar (float * x, float * y, long n, float * mag, float * phase) short DSP_To Rect (float * mag, float * phase, long n, float * x, float * y) Memory Management Data Transfer void * Alloc_M
Chapter 4 Using the DMA VIs ____________________________________________________________________________________________ This chapter describes two special VIs that transfer data between the host computer and the DSP board without interfering with the DSP board. Most VIs in the NI-DSP library run sequentially on the DSP board. In other words, if you run a VI from LabVIEW, even though the actual function is running on the board, LabVIEW must wait for the function to finish before it can do anything else.
Using the DMA VIs Chapter 4 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.
Chapter 4 Using the DMA VIs DSP DMA Copy(DSP to LV) Copies a buffer of size elements from source(DSP Address) on the DSP board to one of the destination arrays in LabVIEW using the onboard DMA transfer method. This VI uses only the DMA controller on the DSP board to transfer data. Therefore, it does not interfere with the other program that is running on the DSP board. Note: This VI does not convert floating-point data to the IEEE format while copying.
Using the DMA VIs Chapter 4 DSP DMA Copy(LV to DSP) Copies the data in the LabVIEW array source to the destination(DSP Address) on the DSP board using the onboard DMA method. This VI uses only the DMA controller on the DSP board to transfer data. Therefore, it does not interfere with the other program that is running on the DSP board unless you copy the data to the DSP memory location that is being used by the other program. Note: This VI does not convert floating-point data to DSP format while copying.
Appendix A Error Codes This appendix contains a list of the error codes returned by the NI-DSP Analysis VIs and the corresponding error messages. Error Conditions If an error condition occurs during execution of any of the VIs in the NI-DSP Analysis, the VI returns an error code. This code is a value which indicates the type of error that occurred. The currently defined error codes and their associated meanings are given in Table A-1.
Error Codes Appendix A Table A-1.
Appendix A Error Codes Table A-1.
Error Codes Appendix A Table A-1. NI-DSP Analysis Library Error Codes (Continued) Error Number Error Name -21343 IndexSizeOffsetErr -21344 -21345 InvalidDataType NumBytesGTZero NI-DSP SRM for LabVIEW for Windows Description The size+offset should be less than or equal to the size of the DSP Handle Cluster that you index into. The data type can only be 4 bytes long(0) or 2 bytes long(1) . The number of bytes to allocate should be greater than zero.
Appendix B Customer Communication For your convenience, this appendix contains forms to help you gather the information necessary to help us solve technical problems you might have as well as a form you can use to comment on the product documentation. Filling out a copy of the Technical Support Form before contacting National Instruments helps us help you better and faster. National Instruments provides comprehensive technical assistance around the world. In the U.S.
Technical Support Form Photocopy this form and update it each time you make changes to your software or hardware, and use the completed copy of this form as a reference for your current configuration. Completing this form accurately before contacting National Instruments for technical support helps our applications engineers answer your questions more efficiently.
NI-DSP for LabVIEW for Windows Hardware and Software Configuration Form Record the settings and revisions of your hardware and software on the line located to the right of each item. Complete this form each time you revise your software or hardware configuration, and use this form as a reference for your current configuration. Completing this form accurately before contacting National Instruments for technical support helps our applications engineers answer your questions more efficiently.
Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. Title: NI-DSP™ Software Reference Manual for LabVIEW® for Windows Edition Date: December 1993 Part Number: 320571-01 Please comment on the completeness, clarity, and organization of the manual. If you find errors in the manual, please record the page numbers and describe the errors. Thank you for your help.
Glossary ___________________________________________________ Prefix Meaning nµmkM- nanomicromillikilomega- 1D 2D Cx dB DFT DMA DSP FFT FHT FIR hex IDFT IEEE IFFT IFHT IIR I/O Kwords LMS LSB LV MB MLUT MSE Mwords pt RTSI SCXI s word Value 10-9 10-6 10-3 103 106 one-dimensional two-dimensional complex decibels Discrete Fourier Transform direct memory access digital signal processing Fast Fourier Transform Fast Hartley Transform finite impulse response (filter) hexadecimal Inverse Discrete Fourier Transf
Index A B Alloc_Mem function, Part 4: 2-3 array VIs DSP Absolute, Part 3: 2-4 DSP Add, Part 3: 2-5 DSP Clip, Part 3: 2-11 DSP Divide, Part 3: 2-20 DSP Linear Evaluation, Part 3: 2-50 DSP Log, Part 3: 2-51 DSP Max & Min, Part 3: 2-52 DSP Multiply, Part 3: 2-54 DSP Polar to Rectangular, Part 3 3-59 DSP Polynomial Evaluation, Part 3: 2-58 DSP Product, Part 3: 2-59 DSP Rectangular to Polar, Part 3: 3-65 DSP Reverse, Part 3: 2-64 DSP Set, Part 3: 2-66 DSP Shift, Part 3: 2-66 DSP Sort, Part 3: 2-71 DSP Square R
Index indexing output arrays to obtain results, Part 4: 2-10 to 2-12 linking, Part 4: 2-7 to 2-8 makelib.bat file, Part 4: 2-8 memory management, Part 4: 2-3 parameter guidelines, Part 4: 2-2 to 2-3 prototypes for customizable functions, Part 4: 3-1 to 3-3 source code creation, Part 4: 2-1 to 2-3 steps for creating, Part 4: 2-1 using WE DSP32C assembly language, Part 4: 2-3 to 2-4 Custom VI. See DSP Custom VI.
Index DSP Parks McClellan, Part 3: 2-55 to 2-57 list of functions, Part 3: 1-2 prototypes for customizable functions, Part 4: 3-2 filtering algorithms, Part 3: 1-5 to 1-6 FIR (Finite Impulse Response) filters, Part 3: 1-6 Free_Mem function, Part 4: 2-3 frequency domain VIs DSP Complex FFT, Part 3: 2-12 DSP Cross Power, Part 3: 2-15 DSP FHT, Part 3: 2-32 DSP Inverse FFT, Part 3: 2-47 DSP Inverse FHT, Part 3: 2-48 DSP Power Spectrum, Part 3: 2-59 DSP ReFFT, Part 3: 2-63 DSP Zero Padder, Part 3: 2-81 Fast Fou
Index DSP Add, Part 3: 2-5 DSP Allocate Memory, Part 3: 2-6 DSP Blackman Harris Window, Part 3: 2-8 DSP Blackman Window, Part 3: 2-7 DSP Butterworth Coefficients, Part 3: 2-9 to 2-10 DSP Chebyshev Coefficients, Part 3: 2-10 to 2-11 DSP Clip, Part 3: 2-11 DSP Complex FFT, Part 3: 2-12 DSP Convolution, Part 3: 2-13 DSP Correlation, Part 3: 2-14 DSP Cross Power, Part 3: 2-15 DSP Custom, Part 3: 2-16 DSP Decimate, Part 3: 2-17 DSP Deconvolution, Part 3: 2-18 DSP Derivative, Part 3: 2-19 DSP Divide, Part 3: 2-2
Index DSP Reset, Part 3: 2-63 DSP Reverse, Part 3: 2-64 DSP Sawtooth Pattern, Part 3: 2-65 DSP Set, Part 3: 2-66 DSP Shift, Part 3: 2-66 DSP Sinc Pattern, Part 3: 2-67 DSP Sine Pattern, Part 3: 2-68 DSP Sort, Part 3: 2-71 DSP Square Pattern, Part 3: 2-69 DSP Square Root, Part 3: 2-70 DSP Start, Part 3: 2-72 DSP Subset, Part 3: 2-72 DSP Subtract, Part 3: 2-73 DSP Sum, Part 3: 2-73 DSP Timeout, Part 3: 2-74 DSP Triangle Pattern, Part 3: 2-75 to 2-76 DSP Triangular Train, Part 3: 2-77 DSP Triangular Window, P
Index DSP Deconvolution, Part 3: 2-18 DSP Derivative, Part 3: 2-19 DSP Integral, Part 3: 2-45 list of functions, Part 3: 1-1 prototypes for customizable functions, Part 4: 3-2 O object filenames, adding to linker file, Part 4: 2-4 output arrays, indexing, Part 4: 2-10 to 2-12 output data buffers, Part 2: 1-5 P U parameters creating LabVIEW interface, Part 4: 2-8 to 2-9 guidelines for custom functions, Part 4: 2-2 prototypes for customizable functions, Part 4: 3-1 to 3-3 utility VIs DSP Custom, Part 3: