From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add a time stamp for data logging

How can I add a time stamp to my VI so that I can record the amount of time in seconds that has elapsed since the begining of my datalogging session?

 

see my attached VI and you will see what I currently have attached which is a tick counter. Basically, how can I change that so I can get a counter that relays that amount of time since the begining of the test.

 

thanks 

0 Kudos
Message 1 of 6
(2,566 Views)
Message Edited by Ravens Fan on 07-28-2009 04:08 PM
Message 2 of 6
(2,561 Views)

I have implimented Ravenfan's VI into mine and am able to get an adaquate reading as far as time is concerned. However, is there a way to set that my system will aquire data every second? rather then varing from .7-1.4 seconds. Or is that all determined by the main building block that I have used to build my VI off from?

 

attached is the current version of my VI 

 

0 Kudos
Message 3 of 6
(2,543 Views)

The rate of your data acquistion is being controlled by your Personal DAQ Main Acquisition Module.vi.  You haven't posted that, so I have no idea what is going on inside.  Since nothing else in your While Loop controls the timing of your program (possibly the Write to Spreadsheet File could cause some slight slowdown in the loop) the control timing of your program must be in that subVI.

 

You do have one major code problem with how you added that while loop near the top.  Its stop terminal is controlled by the "Boolean" switch which is sourced from outside the loop.  If that switch is true, then the inner while loop will run exactly once.  If it is False, then the inner while loop will run forever at top speed and make your VI appear to be frozen.

 

The example I showed you was just a simple while loop to show you how to compare two timing functions.  It is not supposed to be a "drop-in" piece of code.  The while loop in my simple example is supposed to be the big while loop in your program.

Message Edited by Ravens Fan on 07-28-2009 10:17 PM
Message 4 of 6
(2,533 Views)

If you could look at the PDaQ main VI Module it would be much appreciated. I would just like to get a bit more accuracy out of the readings so if you could help in any way it would be greatly appreciated. thanks for all the help.

 

 

0 Kudos
Message 5 of 6
(2,503 Views)

A couple of comments on your DAQ loop:

 

1) Move the initialization code outside the while loop. The initialization case only executes on the first iteration, after that the case statement is just unnecessary delay in your loop.

 

2) You didn't include the *.llb so we can't see any of the sub-VIs. It's difficult enough trying to figure out your code without them.

0 Kudos
Message 6 of 6
(2,489 Views)