From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

will the buffer cleared if the task stopped?

Hi,

  I am writing some samples to the analog output buffer and then start the task. Before the outputing task finished, I stop the task. I wonder will the buffer being clearned if I stop the task? If I start the same task again, will all samples in the buffer be the same as before or only the samples not yet ouputted before it stop remained?

0 Kudos
Message 1 of 6
(2,424 Views)

DAQmx Stop does not clear the aquisition buffer, but you don't really need to worry about 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. 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(2,392 Views)

@Holly-S wrote:

DAQmx Stop does not clear the aquisition buffer, but you don't really need to worry about 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. 


Thanks for the reply. So if I use buffer output, after the task done, if I start the task again, it will stop immediately because pointer is pointing to the very last position, is that correct? Again, if I want to start the task again, I should reset the pointer to the beginning before I start the task again, right?

0 Kudos
Message 3 of 6
(2,379 Views)

What do you mean by use buffer output? The DAQmx Configure Output Buffer VI? Using that VI, you are just setting the size of the buffer but not directing what portion you are looking at. 

 

You should not need to worry about redirecting the pointer when you start the task. LabVIEW should take care of this automatically in a logical way. Are you having issues reading past data after starting a new task? If so, could you please attach a screenshot.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(2,352 Views)

@Holly-S wrote:

What do you mean by use buffer output? The DAQmx Configure Output Buffer VI? Using that VI, you are just setting the size of the buffer but not directing what portion you are looking at. 

 

You should not need to worry about redirecting the pointer when you start the task. LabVIEW should take care of this automatically in a logical way. Are you having issues reading past data after starting a new task? If so, could you please attach a screenshot.


I think I've already figured out the issue. But I still put more about the question.

 

I am outputing multiple samples to one analog channel, which will use a buffer to hold the samples. After my starting the task, the samples in the buffer will be outputed at the interval of the given clock. If I stop the task before it end, the pointer of the buffer will be at the current position. I wonder if I can reset the pointer to anywhere if I start the task again so I can control from where in the buffer I output the samples again. I

 

I've already tried that and it works. Thanks anway.

0 Kudos
Message 5 of 6
(2,345 Views)

I'm confused. You stated that you were wondering if you could reset the pointer to anywhere if you start the task again but then you stated that it works. Were you able to dictate where in the buffer you started from? I am unsure if you still have questions about this post or if you have everything figured out...

Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(2,317 Views)