LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multi channel data acquisition, one frequency, one pulse counter, two voltage inputs, one power meter(by USB), one spontaneous analog output, and record

Solved!
Go to solution

Hi,

I have one power meter which provide the USB driver and Labview program for getting the data and NI USB-6221. The project that I'm currently working on needs to:

 

                         1.Acquire two pressure signals ( simple voltage inputs), update rate KHz

 

                         2. Acquire one flow signal, the output signal is 0 to 5V pulse, every pulse means 0.4ml volume. So I use a voltage inputs to count the pulses in certain period of time(in this case 1 S) to get the flow rate.; sample rate KHz and flow update rate 1Hz

 

                         3.Acquire a speed signal of motor. The output signal is square wave pulse whose frequency is related to speed. I use one FPI port to measure the frequency. Sample rate: automatic

 

                         4.Give sinusoidal or square wave voltage output, I use AO to do that.output rate: automatic

 

                         5. Acquire data from Power Meter by VISA.  Data update rate:every 50ms

 

 

 

Right now, all the 5 tasks work well separately. But when I put them together, some signals start to crash, for instance, the pressure signals sometimes give nothing.

 

Another issue is the data record. I programed the VI in a way that everytime I press the 'start to save' button, it start to save the data and save them to a .cvs file. For some reason, I always only get the data in the first array. coult somebody help me? I upload my code as follows

 

0 Kudos
Message 1 of 5
(3,173 Views)

any advice? any suggestion to improve the data recording would be also great

0 Kudos
Message 2 of 5
(3,163 Views)

Hi,

 

Are you saying you put five measurements in timed loops into this new VI?   Maybe disable all but one of the loops, and verify by adding one at a time that you can run the loops concurrently.  This might narrow down the issue.

 

With regards to the file data saved, you have a lot of build array steps.  You might want to make sure these are all correct, step through the code and look at the trail of data , so to speak, as you build the data array.

 

Not sure what it means to only get the "first array", could be the way you build the data array or the use of the save file VI.  The ,Save to file, is an old VI, I would suggest replacing it with a newer save to file method, like write to spreadsheet, which is clunky, but effective.    There are various methods to saving the data to file, generally Open, Save, close is the preferred method.

 

The data doesn't need to be converted to text just to save it to a file, since all you data is numeric you can just save it as is.

 

By the way, do you have a set of VI's built for this top level VI. I could not load a lot of the Subs, I'm guessing they are not in the VI library.

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 3 of 5
(3,157 Views)

Hi,Mark

 

thank you very much for you reply. I'm trying to clear up my code. I have a question regarding the loops. What the difference between if I put five measurements in a single while loop and put them in five different loops.How would the program process if I put them into five different loops, is there certain process sequence?

 

I'm trying spreadsheet write, thank you for your advice. by the way what is , generally Open, Save, close exactly? Do you prossible have any example?

0 Kudos
Message 4 of 5
(3,138 Views)
Solution
Accepted by topic author hongy

Hi,

 

What I meant by open, write, close.  For whatever file type you are using,

 

Open the file, which produces a reference, then put the reference in a shift register.

Write data over and over, using the write function  (for that file type) and the reference.

Close the file reference when finished.

 

The write to spreadsheet opens, writes, closes all at once.  This is fine for this type of app.

 

***

 

The loop question is more general.  Let me say at first, that I am suggesting that since each loop works on it's own, in it's own VI, and that this program has put them all into one VI, that a method to troubleshoot the issue is to disable all the loops, and enable them one at a time to see if there is a responsible culprit.

 

Using multiple loops runs the code concurrently, and some loops would cycle faster than others, especially if some of them are timed loops as they are. 

 

Communication between the loops is a consideration to address if it is needed.

 

Running all those DAQ signals through different loops needs to also be considered.  Not sure what the issues are for reading and writing somewhat randomly to the channels.

 

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 5
(3,130 Views)