Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Does Setting DAQmx Wait Mode Property to Sleep Work?

Primary Software: Driver Software>>NI-DAQmx
Primary Software Version: 8.9
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: CompactDAQ>>Backplanes>>cDAQ-9172, Multifunction DAQ (MIO)>>E Series, Multifunction DAQ (MIO)>>M Series, Multifunction DAQ (MIO)>>S Series

Problem:
What is the behavior of the DAQmx Read Wait Mode Property when I set it to sleep?  Specifically, my CPU usage seems higher than expected while I am waiting for the desired number of samples during DAQmx Read.

Solution:
The default setting for the Wait Mode Property of DAQmx Read is to sleep for 1 ms.  This means that DAQmx Read will sleep for 1 ms if there are no new samples in the PC buffer to acquire.

If there are any new samples available, DAQmx Read will process the new data and transfer it to LabVIEW memory as the acquisition takes place.  As long as new data is being acquired, DAQmx doesn't sleep and follows the protocol of the yield mode. This allows it to yield control to other threads.

If you would like DAQmx Read to process all of the desired samples at once (and use minimal CPU before then), you can use the Available Samples per Channel property to keep track of the samples in the PC memory buffer.  In this case, you would only call DAQmx Read when the desired number of samples are available to be read (see below).  Generally this should not be necessary since DAQmx Read yields control to other threads after processing samples.


Figure 1: Use of AvailSampPerChan


Related Links:
Developer Zone Tutorial: Basics of NI-DAQmx Property Nodes

Attachments:





Report Date: 04/03/2009
Last Updated: 04/14/2009
Document ID: 4W2F8RFS

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit