05-28-2013 11:02 AM
Hi, I continuously read data from a waveform but I would like to capture and plot the last set of data after my stop triggering. As can be seen in the attacehd picture, when the condition is true I acquire data . The number of samples per read is 1000 and as can be seen I have used a shift register to store data. What I would like to see when the loop stops is the last 1000 samples but when I acquire live data I get random number of samples when the loop stops. sometimes 90 samples , sometimes 950 samples etc....could you please let me know how can I get the last 1000 samples acquired in this loop
I have even used DAQmx buffer to buffer the data but still I can't get the last 1000 samples
thanks
Solved! Go to Solution.
05-28-2013 11:06 AM
Please post the real VI. We can't see how you initialize the task nor how you stop the While loop on that screenshot.
05-28-2013 11:28 AM
Here you are
There is case structure inside the loop. In true case just an empty waveform constant is connected
05-28-2013 12:56 PM
I don't have LV2012 on this machine. Can you save for 2011 or wait for someone else to help!
05-28-2013 01:13 PM
Sure, please find attached .
Thanks
05-28-2013 02:33 PM
A few things to address in your VI:
1 - Why do you stop executing the VI on an Error and not on a "Done?" from your DAQmx task?
2 - You read 100 points (or less) at a time so you are never sure how many points go into your buffer. It is better to have a set number of points and let the Hardware pace your application. You always get same size arrays that way.
3 - If you only read 100 points at a time and place them in the shift register, why do you expect more on your graph? You have to build an array or do somthing else to concatenate your data if you wish to Read the buffer more often but still display more data at the end. Using a chart inside the while loop would also do that for you (see my example.)
On the VI attached, you can easily change the "chart history lenght" to remember as many data points as you wish.
05-28-2013 02:54 PM
I would also point out to tintin99 that if not only the historical plot but the individual data points in it are important, they can be pulled out of the History property node from the Waveform Chart.
Cameron
05-28-2013 03:06 PM
Thanks for the attached file. Your vi is much simpler than mine but I still have the previous problem.
Number of samples is not important. I would like to read the last "n" samples before the stop trigger.
Even using your vi in the last iteration I read a random number ( which is the remaining number of samples in the buffer). Let's use an example
Let's say the number of samples per channel is 100 and I read 56 samples in the last iteration. How can I read the last 1000 samples after the stop triggering? I assume I need to use shift register inside the loop and then concaterate samples in every iteration and finally read the last 1000 samples outside of the loop. I used this method but it didn't work for me.
I hope I could explain the problem
05-28-2013 03:28 PM
If your task has a set number of points to acquire, I do not see how you could have an un predictable and random number of points in the buffer. The task should stop after it acquired the "N" points and then say that it is done.
What do you mean by "Stop Triggering"? You only have a "start trigger" and there are is no points available after the task has competed. If you want the last 1000 points of the "samples per channel" points, then the last read should return those. I have never used the "Done" property before. Count your samples read instead and stop once you've got what you wanted.
05-29-2013 11:45 AM
Got it now, thanks
Just a quick question, if I put the waveform graph ouside of the loop I can only see the last set of data. How can I store the whole data waveform and observe it from start to stop ?
Do I nee dto use build array with shift register to append to the waveform in every iteration?