National Instruments 320571-01 用户手册

下载
页码 157
NI-DSP SRM for LabVIEW for Windows
4-1
Part 4:  NI-DSP Interface Utilities
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.  If you have a custom function that runs indefinitely on the board, LabVIEW will continue to wait.
However, every VI has the ability to check for timeout errors, and you can use the DSP Timeout VI to resolve this
problem by setting a timeout limit.  The host will wait for the DSP board to finish an operation for only the amount
of time you designate; if the DSP board does not complete the function in the specified amount of time, the VI will
return a timeout error.  If your custom function runs a long time or indefinitely, you can set a very short timeout
period and ignore the timeout error in your LabVIEW program.  However, under these conditions you normally lose
communication with the DSP board until you reset it with the DSP Reset VI.
Two VIs–DSP DMA Copy(LV to DSP) and DSP DMA Copy(DSP to LV)–solve this communication problem.
These two VIs can transfer data between the host and the DSP board using onboard DMA without interfering with
the DSP board.  You can use the DSP DMA Copy(LV to DSP) VI to send data to a designated memory location on
the DSP board from LabVIEW when the DSP board is still running.  The function running on the board can read
data from that location and update operations that depend on that data.  LabVIEW can also read data back from the
DSP board using the DSP DMA Copy(DSP to LV) VI to check the status of the board or read results while the board
is still running.  In other words, you can still communicate with the board.
When you use the DSP DMA Copy(DSP to LV) and DSP DMA Copy(LV to DSP) VIs, remember the following:
These two VIs require a real DSP address to transfer data. You can determine this address in two ways:
-
Give a valid DSP address, such as FFF000 hex, if you know the exact DSP memory address of a buffer or
variable that your DSP program will use.
-
Allocate a normal DSP Handle Cluster and use the DSP Handle To Address VI to obtain the valid DSP
address for this DSP Handle Cluster.  You can use this DSP address in your program on the DSP board as
you would use any pointer.  Remember to allocate the DSP Handle Cluster before you call your custom
function through the DSP Custom Function VI.
The data format will not change when you transfer data.  If the data is floating point, you need to convert the
data format in your code between DSP format and IEEE format.  When you send floating-point data from
LabVIEW to the DSP board, convert the data to DSP format before using it in your program on the DSP board.
When you copy floating-point data back from the DSP board to LabVIEW, convert the data to IEEE format
before you save it to the DSP memory location from which you will copy data.
Do not use data acquisition VIs to acquire data to PC memory or send data from PC to DSP memory while
using these two VIs, because these VIs use the same DSP board register, PDR, to transfer data.
Two examples shipped with this package show you how to make use of these VIs.  The examples are installed in the
Examples
 subdirectory of your NI-DSP package.