Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

write to spreadsheet file does not save time data from waveform

I have written a VI that turns on a detector and acquires waveform data from 3 analog inputs.  The data points can be averaged then written to file, or just written to file.  The resulting Excel file from the Write to Spreadsheet File VI does not contain a time column.  What am I missing?
0 Kudos
Message 1 of 8
(4,224 Views)
This is the VI that will not save time data.
0 Kudos
Message 2 of 8
(4,216 Views)

But, you are not even creating a 'Time stamp array' in the first place!

What format/type of time stamp are you looking at?

Note: your Sub VI 'write to spreadsheet file_dbl.vi' is missing.

are you creating a timestamp inside that vi??

Any particular reason why you are perfroming single point acquisition?

 

0 Kudos
Message 3 of 8
(4,208 Views)

1.  I did not create a time stamp array.  I assumed that "waveform" data contains a time column, i.e., starting at 0 each y point coincides with an x point which indicates the number of seconds from the start time.  Upon receiving your comment, I changed my analog input to 1d waveform, and used "get waveform time array."  This works, but the frequency of sampling increases as the program is run.  I also tried creating a time stamp and reading it in seconds, but cannot read fractional seconds.  There must be something simple that I am missing?

 

2.  No particular reason that I am acquiring single samples.

 

VIs attached

0 Kudos
Message 4 of 8
(4,197 Views)
mtngirl,

Thanks for posting to the NI Forums.  Hopefully I will be able to give you a few pointers to get you application up and running.  Specifically, I have two suggestions.  To be able to illustrate my suggestions I have included a picture of a VI I developed.  The VI is written in LabVIEW 8.20 so the error wires are dark yellow rather than pink but the same method will work in older versions of LabVIEW.

    My first recommendation is to switch to hardware timed acquisition rather than the software timed scheme in your current application.  This will give you a few advantages including the ability to ask for more than a single sample and the ability to precisely control the timing between samples. I accomplished this by using the DAQmx Timing VI and changing to the read to Analog > Multiple Channels > Multiple Samples > 1D Waveform.

   The second recommendation is to generate an array of time values for writting to the spreadsheet file.  The waveform data type contains several pieces of data: t0-the date/time that the first point in the acquistion was taken, dt-the time between samples or 1/Sampling rate, and Y- the actual voltages in the waveform.  To extract these values you can use the get waveform components VI.  When you place this VI you will likely only see a single attribute.  By right clicking you can select which item you would like to extract.  In the picture you will notice a for loop that I used to generate the time array.

    Let me know if you have questions.

Regards,

Neil S.
Applications Engineer
National Instruments

The VI:

Message Edited by Neil S. on 08-11-2006 01:29 PM

0 Kudos
Message 5 of 8
(4,182 Views)

Niel:

 

I tried your suggestions, but the VI only collected one set of averaged data, and would only report one set of y values.  However, I used your ideas to create a new VI which reports time and 3 sets of y values.  The problem:  I do not believe that averages are actually being computed, rather, one point from all the data that should be averaged, is reported.  The reason I believe this:  if I ask for standard deviations I get NaN.  I think that I probably need to use a for loop around the get waveform info part of the VI, but when I do this, I get values for averages and standard deviations that do not make sense and do not match the waveform chart.  VIs are attached.

0 Kudos
Message 6 of 8
(4,148 Views)
mtngirl,

You are headed down the right track with the voltages6.vi.  However you are using the GetXY Value VI which only returns a single point of the waveform.  Each DAQmx read reads multiple values.  To extract all of the Y values from the waveform use the Get Waveform Components VI and select Y.  This will return an array of Y values for the waveform (designated by a thick orange wire instead of a skinny orange wire).  You will then not need to use the build array inside the case structure.  Let me know how it goes.

Regards,

Neil S.
Applications Engineer
National Instruments

0 Kudos
Message 7 of 8
(4,137 Views)

Niel:

All is working.  Thanks for your help.

 

0 Kudos
Message 8 of 8
(4,132 Views)