LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daq assistant in while loop

Hi,
I have a very simple LabVIEW block diagram (attached). I'm getting readings from an LCR meter and some load and strain data through DAQ assistant. Both applications are in a while loop. I need all the readings to be at a rate of 10 Hz, so I've got a wait function with 100ms in the loop. Now, I'm not sure if I should set the daq assistant to one sample or continuous samples with 10 Hz rate? and if the latter, then what should I enter for the buffer size?
Thank you
0 Kudos
Message 1 of 5
(4,604 Views)
Acquiring the data continuously at a rate of 10Hz would be the way to do it.
In fact, you could (should) remove the "wait ms multiple".
The DAQ task will wait for the sample to become available thus providing hardware controlled timing.
Memory is allocated automatically.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 5
(4,591 Views)

Thank you very much Troy. I've put the wait function in for the LCR meter, should I still remove it?

0 Kudos
Message 3 of 5
(4,584 Views)

Hi again,

I forgot to mention that when I set the daq assistant to continuous sampling at 10 Hz and a buffer size of 1, there is an error that says:

"This task currently has an error...."

But it seems to be working alright when I run it. Is that ok?

0 Kudos
Message 4 of 5
(4,577 Views)
You can remove the "wait ms multiple". The timing for loop iteration is determined by when a sample is available to the DAQ task (1 every 100ms for 10Hz).
The VISA function will not run again until another sample is available.

Note: the VISA function will run immediately, DAQ function will wait 100ms for a sample to become available. This means your VISA data and DAQ data will be 100ms out of sync unless you force the VISA function to wait until the DAQ has occurred. (Do this by wiring the "error out" cluster from the DAQ task into the "error in" of the first VISA function.
That should reduce how far out of sync your measurements are.

What do you mean "buffer size of 1"? The vi you posted doesn't seem to have any manipulation of the buffer size.
Are you referring to the "number of samples". It should be 1.

I couldn't tell you why you are getting an error (I don't have any hardware here to check it with and I never use the express vis like the DAQ assistant).
It may have something to do with setting up your task as continuous. I don't know how the DAQ assistant task handle continuous acquisition.
You should have a "DAQmx stop task" after you stop the while loop. Other wise you may get a buffer overflow error (if the task keeps running and fills the buffer).
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 5
(4,571 Views)