LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing time to a file along with data

Hello,

I have a vi which I'm using to collect voltages.  From the data collector vi, all 8 channels are output as an array of waveforms which I then split off.  I'm splitting the channels so that I can convert the readings from volts to engineering units (inches, lbs, etc), then merging the signals back as shown in the attached jpg.  My problem is I need to have a time column on the left but I cannot figure out how to do this.  I've tried many different methods, yet as I'm still a novice, I'm sure there is something I have not tried.  I need to be able to get times in milliseconds (relative to the beginning of recording) and possibly 0.000 1 second intervals.

Thank you in advance,
Robbie
0 Kudos
Message 1 of 7
(2,969 Views)

Hi Robbie,

      Try "Get Date/Time String" ( if you haven't found it already Smiley Wink - ) 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 7
(2,960 Views)
Hi tbd,

I tried doing this but unfortunately, all that I could get from it was the same time written to the file each time.  Any other ideas?

A few specifics:  Using DAQmx to read analog voltages continuously inside of a while loop so I'm not sure why the time is not updating.  I will be uploading a copy of the vi to here when I get back to the workstation tomorrow to see if anyone can help me to figure this out.

Thank you for your help,
Robbie
0 Kudos
Message 3 of 7
(2,934 Views)
Hi Robbie,

You should be using the Tick Count (ms).vi to get the time in ms. Also, you might be reading the data too fast for the time to get updated to the next second.

Message Edited by Adnan Z on 03-13-2007 10:04 AM

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 7
(2,919 Views)
At the data rates you list (10kHz?), the millisecond timer will not work.  It has millisecond resolution and accuracy is probably closer to 10-100ms on most desktop operating systems (Win2K, WinXP, MacOSX, Linux), depending on what else is loaded and active.  You want 100 microsecond resolution.  Try doing a continuous acquisition from the DAQ board and using the timestamp in the fetched waveforms.  It should be accurate to whatever your DAQ board timing resolution is.  You will need to ensure you fetch all data from the board, even if you don't use it.
0 Kudos
Message 5 of 7
(2,900 Views)
First I want to say thank you to everyone for your responses.

So here is where I am at now:  I have gone back to using the 'Write to LVM' vi which does give me the time measurements that I require but not a custom file header like I want.  I've currently got a routine that is activated after the user hits the stop button which reads the data from the LVM file and writes it to my own file.  But, the 'Read from LVM' vi refuses to return the time column of this file so that it can be written to another file.  Any suggestions on this attempt?

Thanks again,
Robbie
0 Kudos
Message 6 of 7
(2,893 Views)
The time column in the LVM file is more of a convenience to spreadsheet users than anything else.  You can recreate it from the t0,dt of the waveforms the LVM read returns.  You can either use a FOR loop with the t0, dt as inputs or the ramp generation VI.  Add the result to the beginning of the array of waveforms the LVM read returns, and then save.

If you want to be more efficient and not kill your RAM as bad, try the following method using the LVM data directly;
  1. Open your new file and write your header
  2. Open the LVM file as a normal file
  3. Read the LVM file and toss the data until you get to the end of the header "***End_of_Header***".
  4. Copy the data from the LVM file to your file directly
The specification for the LVM file can be found here, if you want to dive into it a bit deeper.
0 Kudos
Message 7 of 7
(2,884 Views)