03-28-2006 06:02 PM
03-29-2006 09:05 AM
03-29-2006 09:16 AM
03-29-2006 09:33 AM
03-29-2006 09:55 AM
You might want to consider something like doing a continuous acquisition (continuous reads) but discard or simply ignore all the data points you don't care about. It shouldn't be too processor intensive (especially if the data acq is performing DMA transfers, which is does by default in NI-DAQmx Base), but this of course will be system dependent. There are a couple of ways to handle this in LabVIEW, like a producer-consumer loop, or simply using globals (might need to use semaphores/rendezvous to protect shared data structures).
-Alan A.
03-29-2006 02:18 PM
03-30-2006 06:00 PM
03-31-2006 08:44 AM
04-03-2006 11:18 AM
Just to clear something up, I couldn't find anywhere in the DAQmx Base help that a -1 for the "number of samples per channel" input to the DAQmx Base Read VI would read all samples available. That is what it does in DAQmx, but not DAQmx Base. If you did read that for DAQmx Base, please let me know where, so we can get that documentation corrected.
As far as your application, I'm not exactly sure why a producer/consumer loop would not work for you. Effectively, it could be treated exactly as if you were doing a continuous data acquisition and over-writing your buffer. The only difference is that your data acquisition VI would be controlling your buffer instead of the DAQmx Base driver (buffer is in user space and not driver space). So, your daq VI is just continuously reading and writing those points to an array, constantly overwriting the old data. Then, just read from the array whenever you like. You would probably need to protect that data structure with a semaphore (or rendezvous, etc.) to ensure that you weren't reading and writing at the same time. You could expand this to be as elaborate as you want, i.e. if you want to grab 500 samples at a time, you could have your buffer be 1000 samples and maintain a current index integer. That way, you could grab "pre-trigger" data.
Finally, because of the flexibility of NI-DAQmx Base, you could probably create your own start VI that only contains a couple of the low-level VIs that actually start the hardware. Then, use only that VI inside your loop. (I haven't tried this, so I'm not exactly sure how/if this will work) Potentially, this could speed up the execution of the "start".
-Alan A.
04-03-2006 06:35 PM