11-07-2011 03:14 PM
I am trying to write a code that will read and record voltage, temperature and strain on a cdaq 9174 using ni 9221 and ni 9173 cards. The problem is that when the daq assistant is set to N samples it outputs chunks of data in the graphs. I would like it to be a continuous stream so I can see what is actually happening. I have tried changing it to continuous but it either gets an error or takes around 16000 data points in about 10 secs which is way more than I would prefer. The code I am using is borrowed from someone else and when setting it up exactly the same it works on that computer, but not mine. Does anyone have any suggestions on how to solve this problem. I have attached the code as well as the sub vis that is uses.
Solved! Go to Solution.
11-07-2011 03:14 PM
Here is the last sub vi
11-07-2011 03:26 PM
Hi fwowe,
Thanks for joining the forums!
- What have you set for the Max Refresh Rate and Sample Rate when you are running the program?
This will define how often your indictor updates. For example, if you are acquiring 1000 data points at 500 Hz (samples/sec) - this will update once every 2 seconds. To increase the rate of update, lower the points to be read, or increase the sample rate.
11-07-2011 03:28 PM
11-07-2011 04:33 PM
Thanks for the advice I initially set the sample rate at 500 and the max refresh rate at 5. I have played around with them trying different combinations. The problem is the total data points behave as expected but with N samples the graphs are to choppy to be useful and with continuous there are too many data points when running a long test.
Is there maybe another way to display the data that would work better or am I just going to have to accept either bad graphs or a lot of data points?
11-09-2011 11:13 AM
With continuous sampling, your sample rate should determine how many samples you're acquiring every second. If you intend to run this for a long time, you might want to try lowering that sample rate to what you want. You're saying the "total data points behave as expected" but that when continuous, there are too many data points since your test is long. How long are you running the test, and how many data points do you intend to have over the course of the test?
The reason your data comes out in chunks when using N samples is that when you use that setting, you don't need to use a while loop. It collects all "N" samples at once. So in a while loop, each time through the loop, you collect N samples, and it dumps all of those in your chart at once, thus the "chunk." Each chunk is one iteration of the while loop. On the other hand, continuous sampling requires a while loop because the DAQ Assistant "adjusts" the while loop's firing rate appropriately to collect samples at the right rate.
11-29-2011 03:11 PM
Thanks for all the help. I didnt realize at first that the NI 9237 card has a minimum sampling rate of ~1600 Hz. I am now able to sample at 2000 Hz then use continuous decimating to write to my file at 200 Hz.