I am trying to measure nutrient solution ions continuously. I am using NI USB 6343 and LabVIEW 2017. I tried to get/record 100data per second. But, the obtained data rate was not uniform and there was some time gap (like 3, 5 or 8 seconds). I saw similar problems in the LabVIEW discussion forum. I modified the code inserting "wait(ms).VI" and replacing the "While Loop" by "For Loop". The problem remained the same. I can't understand, is it hardware or software problem? Eagerly waiting for your help...
Simple, use 2 different loop. One with a priority to acquire all the point and another one that do analysis and save data.
Thanks for quick reply. I am a little bit confused about the loop (While or For Loop). I have attached a picture here. Did you mean this?
Not at all.
Your current solution will not run in parallel, but rater in serial.
Look at the design pattern: producer consumer, or queue.
This is a "not-understanding-the-hardware-or-the-software" error. Let me explain:
Hello Bob Schor,
Thanks for your nice explanation. I have tried to modify my data acquisition code using "Queue" option. One of them is using DAQassist and another DAQmax. The DAQmax code shows some error. I can't understand how to fix that. In DAQassist code, I can't get my desired number of data. It gives 6~9 data per second.
Would you please check the code and find out the problem, please?
OK. First, you want to read the white paper Learn 10 Functions in NI-DAQmx and Handle 80 Percent of your Data Acquisition Applications. Here are (some of the) specific problems with your code:
With those changes, it should be very close to being correct.
Hello Mr. Bob_Schor,
Thanks again for explaining everything. I tried to modify according to your guidelines. But the problem remained the same. 7 or 8 data per second. Would you please check the code again?
Hello Mr. Bob_Schor,
Would you please check the modified code because the problems remained the same... Eagerly waiting for your response.
Very strange. Sometimes "simplifying" can suggest what's going on. I'd suggest "simplifying" and running the following program:
This is your Producer, except (a) I added a DAQmx Start at the beginning (sometimes it will "auto-start", but I like to "be sure"), (b) removed the Consumer, simply throwing the data away, but (c) adding two indicators, one to show the loop "clocking" (it should count up once/sec, as you are sampling 100 samples at 100 Hz), and verifying that you are getting a 100 x 10 array out (it might be 10 x 100, let me know).
Bob Schor (technically "Dr. Bob", but who uses titles?)