07-18-2006 05:25 PM
07-18-2006 05:33 PM
07-19-2006 12:51 PM
07-19-2006 12:57 PM
Melissa,
I took your VI and modified it slightly to display the number of samples in each of the waveforms returned from the 'data' output of the DAQmx Read VI. I usually see 10 samples give or take a couple now and then, which is what I would expect. With a sample rate of 100 Hz and a delay of 0.1 seconds, you should be getting about 10 samples (100 S/s * 0.1 s = 10 S) from each read. I certainly would not have expected to get samples in multiples of 256 scans.
Which kind of device do you have installed as Dev1? I have a PCI-MIO-16E-1, which is a fairly typical data acquisition board.
07-19-2006 01:20 PM
07-19-2006 03:30 PM - edited 07-19-2006 03:30 PM
Message Edited by Melissa Niesen on 07-19-2006 03:31 PM
07-19-2006 04:02 PM
Glad to see your program is working as intended now.
I'll take a stab at explaining the update behaviour you were seeing. Specifying a timeout of -1 means that the DAQmx Read VI will wait indefinitely for the requested number of samples to become available for reading--10 samples, in your case. However, with the Data Transfer Request Condition attribute set to Onboard Memory More Than Half Full, the device will not transfer samples to the from the AI FIFO to host until this condition has been met. For a sampling rate of 100 samples/second and a FIFO size of 512 samples, it should takes [ ( 512 S / 2 ) / 100 S/s ] = [ 256 S / 100 s/s ] = 2.56 seconds for the condition to be met and for the 256 samples to be transferred to the host buffer. The DAQmx Read VI now has 256 samples available in the buffer to read, and so the request for 10 samples should be satisfied immediately, leaving 246 samples in the buffer. Now the loop continues and comes back around to the DAQmx Read call again. Since there are 246 samples now in the buffer, that 10-sample read should be satisfied instantly, leaving 236 samples in the buffer and so on. In other words, you see updates at 25, 51, etc., because the loop is actually running approximately 25 times every time the data transfer request condition is satisfied.
In general, you shouldn't really need to play around with the Data Transfer Request Condition, as the defaults tend to work for the most part. It just so happened that the DTRC setting in conjunction with your sampling rate and the way the VI was written led to some confusing behaviour. The DTRC can sometimes be used to tune latency-critical applications to transfer samples from the device to the host sooner than it normally would. In your case, this is exactly what you needed to do for your application to work as you would have expected.
07-19-2006 04:22 PM - edited 07-19-2006 04:22 PM
One more thing I just found out. BEFORE the DAQmx Timing VI, AI.DataXferReqCon=Onboard Memory Not Empty. AFTER the DAQmx Timing VI, it equals Onboard Memory More than Half Full!! It is counterintuitive to me that that setting would be used for a task using Continuous Samples.
Your explanation of the 25,51,etc. loop probem makes sense up to a point. Why, though, would the display and probes stop updating with every iteration? I wish I could take a video of this because I might not be explaining it well. I put a probe on a wire coming from the loop counter. The only numbers this probe displays are 25, 51, 76, etc. In other words, it is obvious that the loop is running 25/26 times between the update of the probe display. Normally, the probe display is updated with EVERY iteration of the loop, at least in every other VI I've ever written. Once I correct the Onboard Memory Not Empty setting, I see the probe count up every 0.1 seconds as expected.
BTW, the buffer description you gave IS what I see when I run the "Cont Acq&Graph Voltage-Int Clk-Timed Loop.vi" example when I monitor the available scans property, but it doesn't have any display delays. That one does update every loop iteration. With the default data xfer setting, it waits 5 seconds before even displaying data, then it has a buffer to read from and works fine, although the data would always be delayed by 5 seconds. Not an option for my application, so I'm glad you pointed me to this setting. If I change the setting back to Onboard Memory Not Empty after the Timing VI, this example works as expected, not delaying in the beginning at all.
Message Edited by Melissa Niesen on 07-19-2006 04:24 PM
07-19-2006 04:52 PM
07-20-2006 08:55 AM