12-18-2009 08:07 AM - edited 12-18-2009 08:13 AM
Hi RMW,
As said before, I do not really understand the C-code provided as an example. However I do understand the LabVIEW example that is provided.
Regarding the DAQmxIsTaskDone function:
If you're doing Analog Measurements only, we mainly use the rule that Finite Measurements are done with the DAQmxWaitUntilDone function, and Continuous Measurements are done with the DAQmxIsTaskDone function.
In this case, I've made a mistake in identifying the use of the DAQmxIsTaskDone function: it is used for finding out of the Reference Trigger (Stop Trigger) has been activated. Once this is done, the actual measurement is stopped (meaning closing down the While Loop), after which you need to read the last few samples in the board's buffer.
Enclosed you will find a picture of the LabVIEW implementation (block diagram). This will give you a visual understanding of the steps that are taken.
- If the DAQmxIsTaskDone function presents a True, the "Analog Wfm 1Chan NSamp" will not be executed.
- If the AvailSampPerChan is bigger than 0 samples, these last samples are read in step 9. If the AvailSampPerChan is 0, step 9 will be skipped.
Regarding the amount of samples you need to read from the board's buffer:
- You cannot read more samples from the buffer than the available amount of samples.
- You do not have to read all available samples at once from the board's buffer. If there are 100 samples available, you can read any amount of samples between 1 and 100.
These facts are also the reason that we skip the initial Read function when DAQmxIsTaskDone == True, because the available samples could be less than the amount you normally read at once.
I hope this will make some things clear. The functions that are used in the LabVIEW Example are exactly the same as in C or any other language.
Best regards,
Peter S