LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview multiple channel aquisition

Solved!
Go to solution

Hello Labview experts!

 

I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0). Could anybody help me please?

 

 

0 Kudos
Message 1 of 10
(2,981 Views)

Hi Geordie,

 


@GeordieM wrote:

I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0).


There is some code to determine elapsed time from reading HighResolutionTime. When some time interval has elapsed then you call a case with an EleapsedTime ExpressVI inside. When that ElapsedTime also outputs "time has elapsed" then (and only then) you will write your data because you use that boolean to enable the file writing…

 

What's the point of those two different ElapsedTime calculations?

Why are there indicators without a label (like "time has elapsed")?

Why does your loop rely on a iteration time of 1s when there is a control to change the sample rate?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,952 Views)

@GeordieM wrote:

Hello Labview experts!

 

I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0). Could anybody help me please?

 

 


First of all, get away from that Express vi. It will only cause you problems. When logging data you should always open the file outside the loop (or before starting the DAQ in a state machine) and close the file after the loop (or in a stop state in a state machine). I have attached an quick example to show you how this could be accomplished.

 

You should also look at TDMS logging. You can configure LabVIEW to log directly to TDMS files via the DAQmx drivers. TDMS is a binary format, but there is an Excel plugin that allows you to read it in Excel.

0 Kudos
Message 3 of 10
(2,937 Views)

Hi Gerd.

 

My problem is just with the Save subroutine. I already used this code some time ago successfully but I cannot remember how to set the save subroutine so it gets me an array of data as like as in snapshot below.

 

Could you please advise?

 

GeordieM_0-1626182036913.png

 

0 Kudos
Message 4 of 10
(2,934 Views)

Hi Geordie,

 

you should get a file like that right now!

What kind of result do you get instead?

 

(Is there a reason to stick with lvm files? You could either create your own CSV file using simple file functions or use TDMS as suggested before!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(2,925 Views)

Hi Gerd

 

Thank you very much for your replies

 

The snapshot below is what I get as I switch to TDMS mode

 

GeordieM_0-1626292871514.png

 

I don't understand this issue: I was able to print my data as like as in the previous snapshot (I just changed PC) just using the .lvm format

I'd like to have my four channels in as many columns and one extra column reporting record time

 

 

 
 

 

0 Kudos
Message 6 of 10
(2,882 Views)

@GeordieM wrote:

 

The snapshot below is what I get as I switch to TDMS mode

 

GeordieM_0-1626292871514.png


:Yes, TDMS is a binary format. You will need the Excel plugin to open the TDMS file in Excel, or a TDMS viewer.

 


@GeordieM wrote:
 

I don't understand this issue: I was able to print my data as like as in the previous snapshot (I just changed PC) just using the .lvm format

I'd like to have my four channels in as many columns and one extra column reporting record time

 

 


What does your file look like now? Knowing that would help to direct you as to what the issue might be.

0 Kudos
Message 7 of 10
(2,874 Views)

Hi johntrich1971

 

This is the snapshot of a lvm file as it is generated by Labview.

I know how to remove commas and headers but I'd like to have my sensors readout in four separate columns

 

Thanks for any help you could give me

 

GeordieM_0-1626296686737.png

 

0 Kudos
Message 8 of 10
(2,867 Views)
Solution
Accepted by GeordieM

Hello Geordie,

 

- Please take the advise that others have given you, there are better ways to do what you are trying to do.

 

To get the readings as columns double click the "Convert to Dynamic Data" and from the

Input data type select 1D array of scalars - multiple channels

 

right now you have selected 1D array of scalars - single channel that's why you onle get the data saved as one column.

 

Saludos.

0 Kudos
Message 9 of 10
(2,858 Views)

Great! That's just what I was trying to set! Couldn't remember that! Thanks!!!:)

0 Kudos
Message 10 of 10
(2,851 Views)