Why do USB M-Series Devices Acquire No Data Values on the First Read? Primary Software: Driver Software>>NI-DAQmxPrimary Software Version: 8.3 Primary Software Fixed Version: N/A Secondary Software: LabWindows/CVI Development Systems>>Full Development System Hardware: Multifunction DAQ (MIO)>>Portable>>USB-6251
Problem: I am performing continuous data acquisition using a USB M-Series device and have the DAQmxRead function parameter for the number of samples per channel set to -1. Why does the first call to the DAQmxRead function return zero data points? Solution: The NI-DAQmx driver performs with this behavior to get maximum bandwidth. When setting the "number of samples per channel" parameter to -1 with a task that acquires samples continuously, the DAQmxRead function reads all the samples currently available in the buffer but will return with zero data points on the first read. However, on all subsequent reads data will be returned. This is because by default, the driver does not get data from the device until the device has acquired at least 32kb worth of data. When the driver is queried to see how many points have been acquired, it will think the answer is zero on the first read and return no data. Once the driver has been queried for data, it forces a transfer of whatever is in the buffer so that on the next read (of -1 samples) data is returned. For applications involving a start-triggered acquisition, the second call to the DAQmxRead function will return the data that was acquired when the trigger occured. In other words, the way that the USB device functions with the NI-DAQmx driver does not cause a loss of data. A workaround to avoid this behavior is to specify a number of samples to acquire. Most applications work this way in order to get the same number of points with each read at a consistent rate. Setting the number of samples per channel to -1 will result in getting varied numbers of samples at a varied loop rate. Related Links: New USB High-Speed M Series Multifunction DAQ USB Bus-Powered M Series Multifunction DAQ Attachments:
Report Date: 11/15/2006 Last Updated: 01/19/2007 Document ID: 43EF7NHZ |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
