LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

elapsed timer giving me same numbers and skipping

I have a program here that acquires voltage from two different sources and writes them to a spreadsheet along with the time. When I look at my spreadsheet the column with time will show a couple of times the same and then skip some time and show the same times a couple more times and so on. All of this is sequential. The voltage column will show varying voltages for the same time. Why is it skipping? Why does the same time appear multiple times? I would like to get a steady acquisition rate as fast as it can go. The attached spreadsheet has the first column(Honeywell) deleted from it because it is irrelevent.
Thanks,
Jon
Download All
0 Kudos
Message 1 of 8
(3,705 Views)
You are using the express vi for Elapsed Time. This is incorrect. You need to use the Get Date/Time In Seconds function in the Time & Dialog pallete, then wire the output to the To Double Precision Float function found in the Numeric - Conversion palette. This will give you a time stamp in seconds in a numerical format.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 8
(3,705 Views)

I there,

 

I used the Get Date/Time In Seconds function in the Time & Dialog pallete with the To Double Precision Float function found in the Numeric - Conversion palette but when I take my data, I have the same result with the express vi for Elapsed Time after my substraction to start at 0.  I skip some seconds.  I need to acquire

data at every 5 and 10 sec.  I do a "modulo" on my time in second but it isn't an integer.  I do a "floor" on my result of modulo and then it skip second like the Elapsed Time VI.

 

Do you know what I mean???  >:-s

 

Thanks

 

 

0 Kudos
Message 3 of 8
(3,477 Views)

You need to put the code that you want to wait on inside the True case of a case structure which is wired to the Time has elapsed function of the Timer.

 

As it is now, the loop is running as fast as it can (which is why you see some duplicate times) and are recording all the points.  You are basically at the mercy of the Windows timer which does not have very good resolution.

Message Edited by Ravens Fan on 10-24-2008 05:23 PM
0 Kudos
Message 4 of 8
(3,474 Views)
Besides adding the code to determine when to take a sample, you should use the correct DAQ function to acquire both channels and return a time stamp. If you use AI Channels and return a waveform data type, you can eliminate some code.
0 Kudos
Message 5 of 8
(3,468 Views)

Thanks for your help,

  

I try to take the data at all 5 sec for the graph and all 10 sec for the data for the test.  I use the time stamp of de DAQ with 0,1 for the 10 sec, but I am allways late on the real time.  It is the same thing for the time Elapse VI after 3 acquisitions, I'm late of 1 sec.  What I have to do to acquire data right on time?  I give you an exemple of my code.

 

Thank you again.

0 Kudos
Message 6 of 8
(3,442 Views)

Two quick suggestions.

 

1.  Don't use Local Variables such as ind num temps 2.  Run a wire from where it gets written to the terminal to each location where you are using a local variable.  This prevents race conditions.  If the part of code that uses a local variable gets run before the indicator gets updated, it will be using stale data.

 

2.  Create your DAQ task only once outside the loop.   Clear the task after the loop.  The act of creating the task and clearing it on each loop iteration takes time, and could even cause you to lose data.

0 Kudos
Message 7 of 8
(3,433 Views)

Thanks a lot!!  It works!

 

Gustave

0 Kudos
Message 8 of 8
(3,423 Views)