04-10-2019 08:20 AM
Hello all, I'm using cDAQ-9178, NI 9401,NI 9202 to control multiplexer and read analog signals. At the bottom while loop, when I select multiple channels multiple samples and 1D waveform, the plot waveform is responses very quickly to the sensor. However, if I choose multiple channels single sample and 1D DBL, and send to a for loop for calibration, the data responses very slowly to the sensor, a few seconds delays. Can anyone tell me what's the problem here? any solutions? Thank you very much. Attached is the VI.
04-11-2019 10:45 AM
Check the datasheet for the 9202. It is a very sophisticated device that performs a lot of filtering. One caveat is a limited number of sampling rates. Your choices are 10 and 50, yet your code specifies 40. This selection may return an error, or round to either of the nearest choices. Probe the error output from the read and see if there are any issues. You can also read back the sampling rate to see how it was altered.
Also, cDAQ devices have more overhead than PCI devices and may not be able to transfer a single set of samples at 40 or 50 Hz. You might be better off with the waveform output updating once per second.
04-11-2019 11:39 AM
I don't know the hardware as well as Michael, but I do see that you are specifying 40 samples in Continuous Mode (Good) but are doing a DAQ Read of 1 Sample (Bad). You are doing calibration, for goodness sake -- why not take 40 Samples (as you've specified in the Timing Module) which will properly "clock" the DAQmx Read function? It will also obviate the need for a Build Array as you will already have a 2D array. As a suggestion, if you specify 1D Array of Waveform, then you'll go back to a 1D Array, which will be an Array of Channels (which is what you want to process) and the data will already be a Waveform (so you won't need to "force" it into a Waveform to form "Unfiltered Signal").
Bob Schor
04-11-2019 04:06 PM
I thought the while loop is set to running at 40Hz, so every iteration the DAQ read 1 sample, I'm expecting a column with 8 rows for 8 channels when I probe from the DAQ Read, and each number is updating at the set rate. If I set samples to read as -1 which will read whatever in the buffer, when I probe the output data, it is either one column or sometimes multiple columns. Should I use the timed loop?
04-11-2019 05:06 PM
No!!! Learn about DAQmx. The loop that includes a DAQmx Read "times itself". You (almost) never want to read one sample at a time -- you want to read a bunch. Learn about DAQmx (that means find some tutorials that teach you about DAQmx). Here's a very quick "top view":
Yikes. I got carried away. Did anybody tell you not to use Local Variables until you have been using LabVIEW for at least a year? [I just made up that rule -- a better one might be "Never use Local Variables", but that's too harsh].
So where did that last comment come from? I was looking at your code (thanks for attaching it) and saw a Local Variable called "Saved Cals" and went looking for it. One more suggestion:
Bob Schor