08-15-2006 05:34 AM
08-15-2006 07:10 AM
One thing that newbies sometimes do is use the "simple" VIs too much. While simple to use, they do EVERYTHING, most of which doesn't need RE-DOing every sample.
In other words, you don't need to INITIALIZE a DAQ operation but once. You don't need to TERMINATE it but once. If you are initializing the DAQ every sample, then it has to go thru your 120 channels EVERY TIME, and configure the board EVERY TIME, and that's a great big waste.
You want to CONFIGURE your DAQ ONCE, then sample as many times as you need, then TERMINATE it ONCE.
If you want to fetch data periodically while continuing to acquire it, set your CONFIGURE options to CONTINUOUS ACQUISITION. You can then read data whenever you want, while it's still coming in.
I do 150+ channels at 600 Hz, your situation should be no problem for the hardware to handle.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-16-2006 10:02 AM
Hi Paul,
What CoastalMaineBird has suggested is a possible reason for such latency in your readings. Polling the open and close operations by having open close functions inside the borders of a while loop would create overhead. The normal process model for reading would be
Open > read > close
If you had this code all be inside the while loop it may turn out to be slow and create latency. Alternatively if you were to just open then poll the read operation only i.e. have the open and close on the outside of the while loop it would be more efficient.
There are other ways you can programmatically create such overheads. In most cases there are good programming styles / practices you can adopt to easily avoid running into such issues. It would be helpful for us to inspect how you are programmatically performing the acquisition hence helpful if you could attach your VI for us to inspect the code.
Such programmatic style guidelines and good practices are discussed in our very well rated LabVIEW courses.
Kind Regards,
Kurt
NIUK AE
08-16-2006 10:57 AM
08-17-2006 06:06 AM
08-17-2006 06:33 AM
2... Start with a version of your code that does nothing but the DAQ. Config the thing ONCE, use a FOR loop to read the data, say 100 times. Each time do NOTHING with the data except auto-index it into an output array. Close the DAQ when the loop is done, and graph some part of the data. See if the "jumps" in data are still showing. If they ARE, then your data really is jumping, or your DAQ is not configured corectly to capture what you're feeding it. If they AREN'T, then perhaps you're overloading the CPU with file-writing, graphing, other processing, etc.
3... Use TOP, or if you're on Windows, use the TASK MANAGER to see where your CPU usage is. 120 channels at 10 Hz shoold be no sweat for a modern CPU. If your CPU usage is near 100%, then you're not organized as well as you could be.
One of the things I have done (wen I needed to process BLOCKS of data, i.e. multiple samples) is have TWO separate functions in a WHILE loop: Function #1 acquires data and posts it into a shift register (right side), Function #2 retrieves data from the shift reg (left side) and processes, saves, graphs it, whatever.
Why?
That lets you process data WHILE acquiring it. Acquiring the data doesn't require CPU power, but it does require time to wait for the clock to tick over. The typical brute force scheme says ACQUIRE, PROCESS, ACQUIRE, PROCESS, ACQUIRE, PROCESS. That means that while you're acquiring, you're NOT processing. While you're processing, you're NOT acquiring. You can overlap those functions.
Another thing to consider is letting NI-DAQ buffer the data for you, that's what it's there for. If you tell it to acquire 100 Samples at 10 Hz, then it will do it. You can read them out and process them when time is available. It's perfectly valid to ask for one acquisition of 100 samples, then ask for 100 DAQ READS to process them one at a time.
HTH,
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-18-2006 07:34 AM
08-18-2006 08:45 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-18-2006 08:51 AM
08-18-2006 08:52 AM