LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing waveform max and min to a spreadsheet with a usable timestamp

In part of an application I am writing I am using the 'waveform min and max' function, wiring the 'max time', 'max', 'min time', and 'min' to a 'build array' and then taking this array into the function 'write to spreadsheet'. When I look at the file created I find that the max time and min time are both reported as '3135686400.000'. I am new to labview, so maybe I am making a simple mistake, but that doesn't represent a time to me.

Thanks in advance,
Travis
0 Kudos
Message 1 of 17
(3,036 Views)
I think its the date in seconds since 1904 you are getting. You will have to manipulate it either in excel or labview to display the way you want. Don't forget that for excel the default is 1900 so you will have to change it to 1904
Message 2 of 17
(3,036 Views)
The number is the number of seconds since 12 am Jan 1, 1904. You'll need to convert that to a date/time string before writing it to a spreadsheet file. You can use the function Format Date/Time String. I don't know why you are seeing the same number for min time and max time unless you've got a wiring error.
Message 3 of 17
(3,036 Views)
Thank you
0 Kudos
Message 4 of 17
(3,036 Views)
Thank you
0 Kudos
Message 5 of 17
(3,036 Views)
I have been trying to figure out why my max time and min time are the same. I thought I might have made a wiring mistake to my build array, but I didn't, so I can't figure out why this would report the same time, when the values for my max and min are reported as different -- could this be because the max and min times are only ms apart, and the time reports the number of seconds. Also -- is there a way to calute the rise time of a waveform -- or do I have to find the 10% and the 90% point and calculate the time between them by writing a sub vi.

Thanks,
Travis
0 Kudos
Message 6 of 17
(3,036 Views)
If it's only 1 or 2 msec, then I suppose you could be seeing a limitation in the resolution of the PC clock but you might try posting your VI to see whether someone here might spot a different problem. For rise time, look at the Transition Measurements fucntion. Its on the Waveform>Waveform Measurements palette.
0 Kudos
Message 7 of 17
(3,036 Views)
Actually, it's very easy to convert the number. As stated elsewhere, the LV timestamp is equal to the number of seconds since Jan 1, 1904. An Excel timestamp is the floating-point number of **days** since Jan 1 1900.

One of the reasons for this change is that Excel only does single-precision math (which is also why it sometimes gives different answers than LV) and the number of seconds won't fit in a single precision number with sufficient accuracy to be useful.

To make the conversion, first divide the LV timestamp value by the number of seconds in a day. This returns the number of days since Jan 1, 1904. Now if you want to change the calculation options in Excel to use 1904-based time, you're done. But remember that the offset is a fixed value so it is
a simple matter to subtract-out the number of days between Jan 1 1900 and Jan 1 1904. This way you'll get the right answer without having to remember to play with the configuration.

The result is a number that you can format in Excel as a Time/Date.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 17
(3,036 Views)
here's two VIs I use for converting between formats.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Download All
0 Kudos
Message 9 of 17
(3,036 Views)
Mike,

Those are helpful programs -- I have a question though. I am using a sequence with 3 parts/events. I want to record the time that the the 2nd part of the sequence begins. I know there is a function that spits out the number of seconds since Jan 1, 1904 -- which is fine, but I don't know where to place it. (My first event in the sequence runs for 1 minute, the second for 60 minutes, and the third for 5 minutes -- and then a for loop makes it repeat).

Thanks,
Travis
0 Kudos
Message 10 of 17
(3,036 Views)