Specifying Number of Samples When Continuously Acquiring with NI

您所在的位置:网站首页 labview采样数必须大于0 Specifying Number of Samples When Continuously Acquiring with NI

Specifying Number of Samples When Continuously Acquiring with NI

2024-07-10 09:16| 来源: 网络整理| 查看: 265

The size of the array/waveform, as well as the size of the DAQmx PC Buffer, are implicitly determined by the configuration of the DAQmx task, as outlined below.

When performing an acquisition with DAQmx, data is first transferred from the DAQ Device into the memory (RAM) of your computer. There is a a preallocated buffer on your computer's RAM, called the DAQmx PC Buffer, which is reserved as a holding place for unread data.聽

Data can then be read from the DAQmx PC Buffer and into an array or waveform inside of your DAQmx application by executing the DAQmx Read function.

When you configure the DAQmx Timing VI for your task in LabVIEW, the聽Samples per Channel聽value has a different effect depending on whether the聽Sample Mode聽is set to聽Continuous Samples聽or聽Finite Samples.聽

For聽Finite Samples, the聽Samples per Channel聽value determines the number of samples to acquire before the task completes.For聽Continuous Samples, the聽Samples per Channel聽value is used to determine the size of the DAQmx PC Buffer if the default buffer size is not sufficient.聽 However, in most cases, the default buffer size is used and this value is ignored. See聽DAQmx Buffer Size Allocation for Finite or Continuous Acquisitions for more information about how buffer size is determined for continuous acquisitions.聽

Conversely, DAQmx Read has an input called聽Number of Samples per Channel. The聽Number of Samples per Channel聽value determines the size, in samples, of each array or waveform of data that is read from the buffer into your application when DAQmx Read is executed.聽

It should be noted that DAQmx Read will wait until all of the requested samples have been acquired and stored in the DAQmx PC Buffer before providing the data to the application.

Consequently, if the sampling rate is not fast enough to create an array or waveform of this size in the time allotted by the timeout, the VI will throw a timeout error. To prevent this, increase the timeout parameter (the default value is 10 seconds), or reduce聽Number of Samples per Channel.聽

Additional Information

Note:聽The transfer speed between the DAQ device and the DAQmx PC Buffer on the host computer's RAM depends on the bus being used to communicate with the DAQ Device (PCI, USB, PXI, etc.).

In the interactive DAQ Assistant panel, as well as in SignalExpress and NI MAX, this parameter is renamed聽Samples to Read,聽as shown below:

The default value for聽Number of Samples per Channel聽is -1, which causes DAQmx Read to read all data that is available in the buffer immediately. If no data is available in the buffer when聽Number of Samples per Channel聽is set to -1, DAQmx Read will return an empty array rather than wait for samples to be acquired.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3