LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Current time that is in-sync with my data feed? (my attempt)


Detect_That_Fall wrote:

I have applied this to my VI, which did fix the issue, but now all the timing points are equal.


I understood your earlier reply to mean that it is acceptable if all the points within one group have the same timestamp.  If the code that I suggested is within your loop, you will get a new timestamp along with each new group of data.  Perhaps I misunderstood what you want?  Or, did you put the time function outside the loop, so it's reusing the same time value?

 

As Lynn points out, you may not need a timestamp for every point if the time between points is consistent.  If you do want an individual timestamp for each point, instead of using Initialize Array you could use a for loop to generate the correct number of timestamps, incrementing (or decrementing) the value each time.  For example, if you assume the current time corresponds to the last measurement, you could use something like the code below to generate an array of timestamps.

timestamp array.png

An improvement over this would be to use a shift register in the main loop of your program, initialize it once (from the outside) when the program starts, and then continuously increment the timestamp.  This way the difference in time will be consistent from one group of points to the next, but it is possible that it will get out of sync with real time if your program is slow for some reason.

 


Detect_That_Fall wrote: 

Wouldn't this use up RAM? 


This question doesn't make sense.  Shift registers are efficient in memory use so long as the data in them stays a constant size; they are only a problem when they grow constantly (for example making an array or string longer on each cycle of a loop).

0 Kudos
Message 21 of 21
(185 Views)