LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital inputs to start and stop analog signal

Hi, I'm new to Labview and I have a question:
 
I have a continuous analog signal coming in and two digital inputs, say DI1 and DI2.
How can I use these digital signals to start and stop the collection data of the analog signal?
 
So, when DI1 is one, I would like labview to collect the data from the analog signal and when DI2 is one, I would like labview to stop collecting the data.
 
Can someone please help me? Smiley Happy
 
Jeroen
0 Kudos
Message 1 of 7
(3,315 Views)

So, D1 initiates data collection and D2 indicates it is time to turn off. I would think that one digital output is all that is needed to turn something on or off. In other words, you want to turn collect data then turn on D1. Ok I want to stop collecting data then Turn off D1. That is how I would do it. I would implement it using a simple true/false Case structure. A better description of your application may yeild better results.

0 Kudos
Message 2 of 7
(3,302 Views)
Thanks for your reply!
 
I've tried the case structure and it works pretty good.
I now use one digital input (D1) to start and stop the data collection of the continuous signal.
 
Is it possible to save the data in a seperate column after each run?
 
So, I start the program and I make D1 true, so the collection of data starts, then D1 becomes false so the collection of data stops. I call this run1 and this data is saved in the first column (I used a Labview Measurement File). Now I do the same again ("run2"): start stop and another set of data is saved. But this run2 is appended to the previous data. Can I place the data from run2 in column 2 in the LVM file?
0 Kudos
Message 3 of 7
(3,286 Views)
I am a nebie as well! I would think you could tab over and start a new column. I am currently writing my first LV program and have jsut reached the data collection portion of my program. I was able to scroung around last night and get a template on how to store data to an excel file in a very nice manner. YOu should do a search for how to store two columns in the same file. I really do not have an answer for you. If I stumble across anything in my travels I will post it.
0 Kudos
Message 4 of 7
(3,278 Views)
Unfortunately, the LVM Express VIs do not support this functionality. It would be a very slow process, since almost the entire file would need to be rewritten - columns are interleaved on disk.

However, you have two options using LVM to get what you want. First, you can read the old data out of the file, create a multi-dimensional data set from the old data and your new data, then write back to the file. This will be somewhat slow and get worse every time you add a data set. Second, you could cache your data in memory (use a shift register) write it all when you are done.

Both of these methods assume you have enough memory for all your data. If this is not the case, you may want to consider one of the binary formats (TDMS or HWS) which allow you to write multiple data sets to the same file.

If you run into memory issues, you may want to check out the tutorial Managing Large Data Sets in LabVIEW. It is a somewhat advanced tutorial, so let us know if you run into problems.
0 Kudos
Message 5 of 7
(3,274 Views)
Hmmm... the tutorial is too advanced for me.
I understand that memory could be a problem, so maybe I can't use the LVM file.
 
But even for small data sizes, I don't know how to fix the problem in Labview.
Say I have a signal with 100 datapoints. I define the dataset1 as the datapoints between 10 and 20, the dataset2 as the datapoints between 40 and 45 and the dataset3 as the datapoints between 85 and 100. So dataset1 has 10 values, dataset2 has 5 values and dataset3 has 15 values. How can I put each dataset in a different column?
 
0 Kudos
Message 6 of 7
(3,260 Views)
Two relatively easy methods to do this.
  1. Split the data apart using Array Subset from the Array palette. Recombine these three arrays using Build Array, once again from the Array palette. Make sure you are not concatenating the arrays. Wire this 2D array (the wire will look different) directly into the Write LabVIEW Measurement File Express VI. This will give you three columns. The down side of this method is that the 2D array created will expand the shorter elements so they are as long as the longest elements, increasing your memory use. You will also probably get zeroes in your file. Which brings us to method 2.

  2. Split your data apart, as before. Convert each data set to a dynamic data type using To DDT from the Express->Signal Manipulation palette. Combine them using Merge Signals from the same palette. Wire this into the Write LabVIEW Measurement File Express VI.

You can do something similar to method 2 using waveform data types, as well, which allows you to set t0 and dt values for each data set. The basic idea is that you need an array of waveforms to get multiple columns.
0 Kudos
Message 7 of 7
(3,252 Views)