From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Stop Task: Does executing this function clear out the acquisition buffer?

Hello everyone,

 

When you execute the DAQmx Stop Task function, is the buffer of acquired data points cleared out, or are any acquired, unread points still in the buffer, so that when you restart the DAQ task using the DAQmx Start Task function and peform a read, the older data points are read in?

 

For some context on why I am asking this question, here is a little background.  I was looking in LabVIEW 2010 SP 1 for a DAQmx Clear Buffer function, but couldn't find it.  So, I figured the Stop Task function would probably do that, but nothing on the help forums or in the help files seems to say that it will.  The Stop Task function will put the task in the "state it was in before the Start Task function was executed".  I am not sure if that refers only to validating the task and committing the hardware, or also to the buffer, as well (I could imagine the buffer being maintained by design).  I wish the help files were more explicit about what will happen when the Stop Task function executes.  If I am missing it in the help files, and it is there, please let me know.

 

Anyway, the application I am working on involves the user acquiring some data, and then reviewing it for an arbitrary amount of time before deciding whether he wants to peform another acquisition.  While the user is performing his review, I don't want to overrun the data acquisition buffer, so I stop the DAQ task, to restart it later if need be.  When I restart it (if the user decides he wants to acquire another data run), I want no data in the data buffer and the only data acquired to be data from the moment the user initiates the next acquisition till when he stops it.  After I execute the Stop Task function, I planned on using a Clear Buffer function, but as I mentioned, I couldn't find the Clear Buffer function.  So, I would like to know if the Stop Task function does this, or do I need another strategy?

 

Thanks for any help, and if you have any comments on how to improve my software's design, I would welcome those comments.  If you need to know anything else that I've omitted, please let me know.

0 Kudos
Message 1 of 5
(4,541 Views)

Hello,

 

DAQmx Stop does not clear the aquisition buffer, but you don't really need to worry abou that.  When DAQmx Start Task is called, the read pointer is set to a new point in the buffer, so when you read you will only get data from the current iteration of the task.

 

I hope this answers your question.

 

Regards,

Matt M

Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,519 Views)

Hi all,

 

to ask further questions, applies Matts statement to all DAQmx versions since NI-DAQ 7.0 (which introduce DAQmx)? Are the details Matt refer to are somewhere documented?

 

Hope someone at NI can clarify this.

 

Thank you in anticipation


K-Bot

 

 

 

Using LabVIEW 8.5 on WinXP
0 Kudos
Message 3 of 5
(4,387 Views)

I believe that this functionality is the same for all versions of DAQmx, but I am having trouble locating documentation to verify this.  The article below is the most relevant document that I was able to find:

 

What is the Difference Between the DAQmx Stop Task VI and the DAQmx Clear Task VI?

http://digital.ni.com/public.nsf/allkb/C711E912243C8B7886256D260069B63B?OpenDocument

 

 

Regards,

Jared R.
Precision DC Product Support Engineer
National Instruments
0 Kudos
Message 4 of 5
(4,361 Views)

One thing I've done is to generate my Sample Clock signal with a counter pulse train task.  This makes it

pretty easy to start and stop multiple other tasks while keeping their acquisition buffers in sync.  Just keep

the other tasks running continuously, but choose when to start and stop the sample clock signal.

 

You'd probably want to query the other tasks for the property "TotalSamplesAcquired" just before starting

the pulse train and just after stopping it to help designate which data belongs to which grouping.

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 5
(4,324 Views)