Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
LabVIEW-Measurements.pdf
Скачиваний:
61
Добавлен:
29.05.2015
Размер:
3.37 Mб
Скачать

Chapter 6

Analog Input

If you want to take more than one reading on one or more channels, acquire your data as waveforms. There are two buffered waveform acquisition techniques you can use depending on what you want to do with the data after you acquire it: simple-buffered acquisition and circular-buffered acquisition. This section explains buffered waveform acquisition and shows these two techniques. Throughout the chapter are some basic examples of some common DAQ applications that use these two methods.

Using Simple Buffers to Acquire Waveforms with the

Data Acquisition Input VIs

With buffered I/O, LabVIEW transfers data taken at timed intervals from a DAQ device to a data buffer in memory. In your VI, you must specify the number of samples to be taken and the number of channels from which LabVIEW will take the samples. From this information, LabVIEW allocates a buffer in memory to hold a number of data points equal to the number of samples per channel multiplied by the number of channels. As the data acquisition continues, the buffer fills with the data. However, the data may not actually be accessible until LabVIEW acquires all the samples. Once the data acquisition is complete, the data in the buffer can be analyzed, stored to disk, or displayed on the screen by your VI.

Acquiring a Single Waveform

The easiest way to acquire a single waveform from a single channel is to use the AI Acquire Waveform VI, as shown in Figure 6-13. Using this VI requires you to specify a device and/or channel, the number of samples you want to acquire from the channel, and the sample rate (measured in samples per second). The information you enter in these parameters are included in the waveform data.

You can programmatically set the gain by setting the high limit and the low limit. Using only the minimal set of inputs makes programming the VI easier, but the VI lacks more advanced capabilities, such as triggering.

Figure 6-13. Acquiring and Graphing a Single Waveform

© National Instruments Corporation

6-21

LabVIEW Measurements Manual

Chapter 6

Analog Input

Acquiring Multiple Waveforms

You can acquire more than one waveform at a time with another of the Easy Analog Input VIs, AI Acquire Waveforms. This VI also has a minimal set of inputs, but it allows inputs of more than one channel to read and returns an array of waveforms from all channels it reads.

To access or control an individual waveform, index the array of waveforms with the Index Array function or use input indexing on a For or While Loop.

The VI in Figure 6-14 acquires waveforms from multiple channels and plots the waveforms on a graph. In addition, the Index Array function accesses the first waveform in the array and sends it to a filter, which sends the waveform to another graph.

Figure 6-14. Acquiring and Graphing Multiple Waveforms and Filtering a

Single Waveform

The channels input for the AI Acquire Waveforms VI has a pull down menu where you can select a channel from a list of configured named channels. You also can type a list of channels into this input. You can set the high limit and low limit inputs for all the channels to the same value. Like the other Easy VIs, you cannot use any advanced programming features with the AI Acquire Waveforms VI.

You also can acquire multiple waveforms using the Intermediate VIs. The Intermediate VIs provide more control over your data acquisition processes, like being able to read any part of the buffer. An example similar

to Figure 6-15 is the Acquire N Scans VI, located in labview\examples\ daq\anlogin\anlogin.llb. With the Intermediate Analog Input VIs, you must wire a taskID to identify the DAQ operation to make sure the VIs execute in the correct order.

LabVIEW Measurements Manual

6-22

www.ni.com

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]