LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need a timestamp in milliseconds that starts when my program starts

I currently have the current time in milliseconds as a time stamp. I thought I could program a loop that would subtract the first current time from each but I couldn't make my loop do that. Does anyone know how to make a loop such as this or is there an easier way. Also, my time stamp needs to be in the form of a string. This is also causing me problems. Any help would be greatly apprecieated.
0 Kudos
Message 1 of 9
(4,141 Views)
I seem to have no problem with doing what you asked. Even conversion to string. What type of loop are you using?

Here was my test program for this.

Rob
0 Kudos
Message 2 of 9
(4,141 Views)
Thanks for the help, but the while loop when used in my program executes but doesen't move onto the next part of my program. I think what happens is because it is a while loop it contiously runs and it is executing and printing out the time since start, but my program is not using those times. I think what I really need is a running clock that prints the time since start at the time each data point is taken. Do you think a case structure would do this?
0 Kudos
Message 4 of 9
(4,141 Views)
I'm a little unclear here. How are you collecting the data? How are you storing it? Please elaborate a little, maybe attach an example if possible.
0 Kudos
Message 5 of 9
(4,141 Views)
I've attatched my VI as I have it right now with a current time stamp. I found that, with the timestamp in a while loop my program gets stuck in the loop and is continously running. So it doesn't execute the rest of my program. I'm getting my data values in the form of an array from a CIN then making it a spreadsheet string then I concatenate the spreadsheet string and a string that has my current timestamp and write them to a file.
0 Kudos
Message 6 of 9
(4,141 Views)
You are using this vi as a subvi? If so then remove the while loop and I don't think that you will have a problem.

Brian
0 Kudos
Message 7 of 9
(4,141 Views)
If you are using LV v.6i, the waveform data type with give you a string
array that provides you with a column for the time of each data point
accurate to microseconds, a column for the actual data, and a scalar value
for the time between each data point (delta t). The only problem is that
the time data is not really accurate to microseconds since the timestamp is
taken from the p.c. system clock and the system clock is only accurate to
miliseconds at best.

carissa


Amy Slaga wrote in message
news:506500000008000000F12E0000-1003545641000@exchange.ni.com...
> I currently have the current time in milliseconds as a time stamp. I
> thought I could program a loop that would subtract the first current
> time from each but I couldn't make my loop do that.
Does anyone know
> how to make a loop such as this or is there an easier way. Also, my
> time stamp needs to be in the form of a string. This is also causing
> me problems. Any help would be greatly apprecieated.
0 Kudos
Message 3 of 9
(4,141 Views)
Perhaps I am not understanding the depth of the question, but it seems to me
that the attached html should show you how to achieve your goal of having a
loop that saves delta times. Read your initial time outside of the loop,
then at each loop iteration read the current time, do the subtraction and
store the result. Using automatic indexing at the output of the loop will
create your array automatically.
Hope this helps...

Jim


"Amy Slaga" wrote in message
news:506500000008000000F12E0000-1003545641000@exchange.ni.com...
> I currently have the current time in milliseconds as a time stamp. I
> thought I could program a loop that would subtract the first current
> time from each but I couldn't make my loop do that. Does anyone know
> how to ma
ke a loop such as this or is there an easier way. Also, my
> time stamp needs to be in the form of a string. This is also causing
> me problems. Any help would be greatly apprecieated.



[Attachment Delta_Timestamp_1.html, see below]
0 Kudos
Message 8 of 9
(4,141 Views)
Thank you for all the help. I got my program to work. I was trying to use a subvi as the timestamp, but I changed my method and put the timestamp directly in my vi. And it worked. Thanks.

Amy
0 Kudos
Message 9 of 9
(4,141 Views)