Showing results for 
Search instead for 
Did you mean: 

Recording data for set time, mismatch between set and saved log time

Go to solution

Hi, I'm trying to write a VI that takes in continuous data from a few thermocouples, displays the current temperature through a chart, and also saves the temperature for a certain period of time when specified by the user via a button. The code seems to be mostly working with one small issue, the log time of the saved data and the log time set in the VI do not match up. For examples, if I set the log time to 10s in the VI, the saved data from a single recording will only be for 8.8s or something similar. Any help you could provide with fixing this would be greatly appreciated, thank you.

Download All
0 Kudos
Message 1 of 3
Accepted by topic author Travis1

Let's just say that you are dealing with different timing sources that are not quite the same.  You are also fighting the fact that the Elapsed Time will output a TRUE when the time is greater or equal to 10 seconds.  So if 10.1 seconds has passed, whatever you just collected will not be recorded.


The better route here would be to determine the number of samples you actually want to collect.  If you have a sample rate of 5 S/sec and you are collecting 5 samples per iteration, that comes out to 1 second loop rate.  So if you want 10 seconds of data, just collect for 10 iterations.  So you just keep a simple counter in a shift register.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3

Thanks, I redid the data reading with your advice and was able to make it work. Not sure if it's the most efficient way to do it but it gives me the result I want.

0 Kudos
Message 3 of 3