LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start Task and DAQmxRead.vi

Suppose i use the DAQmx Read.vi before starting a task will the vi read from the buffer already stored data or do i have to start the task again to read the data in the buffer if so then will the acquisition will be triggered when i start the task?
Please clarify this doubt of mine.
Elaborating with an Example
I Have created a virtual channel with continuous sampling with sampling rate of 1000Samples/ S my signal frequency is say only 1Hz, the buffer size is 4000 Samples i do this all using DAQmx vi's to get a newly created task. Now I aquire for 2 seconds assuming my acquisition starts as soon as i start the task inside the while loop i do the reading of samples from the buffer at a slower rate say 100 samples/sec. So in turn i must run the while loop at least for 10 times to acquire all the samples assuming now that the while loop executes at 100ms so by 10 iteration it would have run for 1 second in this case my acquisition will acquire the new data samples an throw it in the buffer. If the execution of while loop is improper or does not execute at 100ms then i might end up losing data or acquiring more data.
All i want to know is
1. Does the start task mean starting acquistion.
2. Do we have to start a task to read samples from the buffer.
Thanks
Bye
K.Narayanan
0 Kudos
Message 1 of 4
(3,033 Views)

Hello naru,

If you use a DAQmx Read with no task that has been started, it will just go out and read however many samples you have specified, not from the buffer because you have not configured a buffer to read from. 

If you set up a continuous acquisition, you will not lose data because the while loop iteration time is not exact.  The data will be acquired with the timing you specify and then put in the buffer continuously and each loop iteration will read the number of samples you specify without skipping any.  If you were to stop and start the task inside the while loop each time it iterated, then you would probably lose some data. 

The start task VI does start the acquisition.  If you have configured a trigger, then no data will be acquired until the start task VI has executed and the trigger has been received. 

If you have a continuous acquisition that you have stopped by stopping the while loop and then use a DAQmx Read VI outside of the while loop then you can read the remaining samples (if any exist) in the buffer.  However, if you stop or clear the task using the DAQmx Stop or Clear Task VIs then you will not be able to read the remaining samples. 

Hope this helps,

Laura

0 Kudos
Message 2 of 4
(3,010 Views)

Thanks

I understood that the reading rate of the samples from the buffer is dependent the dll used for the same and  on the rate of execution of while loop so figured out that it is required to start a task before reading also starting a task does not means starting the acquisition always.

Thank you once again,

Naru

0 Kudos
Message 3 of 4
(3,004 Views)

Hi naru,

Glad I could help.  Let me know if there is anything else that needs cleared up.

Thanks,

Laura

0 Kudos
Message 4 of 4
(2,986 Views)