LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multi channel multiple sample

Hi,

 

I am using USB6218 DAQ device and Labview 9. I have used DAQ assitant in my VI and my setting are RSE mode to sample 30 channels, continuous mode,20 samples,rate 100hz. This is what I had in mind from my programming background from C/C++ and I am new in using Labview. I was trying to get 20 samples from channel 1 in 10ms period and store in an array for eg channel_1_val[20] and switch to channel 2 and get 20 samples in 10ms time and store in channel_2_val[2] and so on for thirty channels. I figured timing should not be an issue as USB device has 250Ks/S for 32 channel which would approx 7ks/S for channel which is 120us roughly. So 20 samples in 10msec is plenty of time. Does the setting in DAQ assistant would do my above task as expected. Need help from experts.

 

Thanks

0 Kudos
Message 1 of 6
(3,638 Views)

No, DAQmx does not exactly do what you want.

 

If you want to acquire 20 samples from 30 channels it takes the first sample from all the channels, then the second from all the channels and so on.

Please see Data Acquisition Sampling Terminology.

 

DAQmx returns something like:

Ch0/sample0, Ch1/sample0, Ch2/sample0, Ch3/sample0, Ch4/sample0, ........... Ch0/sample1, Ch1/sample1, Ch2/sample1,.........

 

 

Christian

0 Kudos
Message 2 of 6
(3,630 Views)

Hi Christian,

 

Just curious to know what I think is gonna happen to my attached VI. Please correct me if I am wrong. I am expecting, channel 1 sample 1 and a msec later channel 2 sample 1 and a msec later channel 3 sample 1 and so forth. And when all my 20 samples for 30 channels are acquired which would take roughly 600msec the while loop will wait for 500msec to start the next sampling. This is what I had in mind when I created the VI. I am also curious to know is there any buffer allocated or it just takes a sample from channel 1 writes in a register or memory and after a msec takes a sample from channel 2 and overwrites on the same register or memory. The reason I am asking that is I would like to write all my samples on an excel in a format given below and fill an array with 20 samples from each channel and take an average to determine the pressure leak

 

Timestamp        |          channel no          |        Voltage(v)               |         Pressure(psi) 

 

and may be plot a graph based on how fast I get this done. Currently write to spreadsheet on my Vi is filled with rows equal to no of samples and just one column. I am guessing that I need a build an array with the value that I sample everytime after a msec and finaly write this array to excel. If that is the case how will I form the dynamic array. Thanks for your support.

0 Kudos
Message 3 of 6
(3,602 Views)

No. Each msec you will sample 30 channels and since you request 20 samples, you will get data after 20msec.

 

Your conversion from dynamic data is also all wrong. You would want to convert to a 2D array. As it is now, you are throwing away most of your data.

0 Kudos
Message 4 of 6
(3,582 Views)
I tried to convert dynamic data from DAQ assistant into 2D array and connect it to get waveform components. I get an error that the source and sink doesn't match. Is it possible to extract the timestamp without using "get waveform component vi" along with the data. I need all the 10 samples from 30channel and average the 10samples. Thanks
0 Kudos
Message 5 of 6
(3,562 Views)
That wasn't in your original code. You would not convert to 2D data. You would convert to 1D waveform data type and if you needed the timestamp, index the first element and wire that to the Get Waveform Component. Don't know what that has to do with getting the average for each channel. To get that, just place the mean function inside a for loop and wire the array of waveforms through the for loop. Wire the output through to get an array of means.
0 Kudos
Message 6 of 6
(3,555 Views)