LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

view data continuously but only record every x seconds

I am trying to view my data continuously on my front panel, but only store it every "x" seconds, like every minute or every 10 minutes.

I can do this with two while loops within the same state of my state machine, but my problem is that if I want to quit the program and I am saving data every hour, like for a long program run time, my program doesn't stop for 1 hour.

Any ideas?

Thanks

Terry
0 Kudos
Message 1 of 7
(5,250 Views)
You are headed the right direction.

In your "1 hour loop" change the structure so it loops every second or so, but conditionally write the data only when an hour has elapsed.

In this loop, watch for a local copy of the exit button of the first loop.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 7
(5,250 Views)
How do I conditionally write the data every hour? That is what I have been hung up on. I am writing this data to an array that is indexed out of the loop.
0 Kudos
Message 3 of 7
(5,250 Views)
Hi Terry,


Try something like this....

Keep an index of all the loops per second. Divide this number by 86400 (#
of seconds in an hour) if the remainder = 0 , then write to disk, else
don't write to disk....its simple but it works....let me know if you'd like
an example....

reg

"TerryE" wrote in message
news:506500000005000000848B0000-1023576873000@exchange.ni.com...
> How do I conditionally write the data every hour? That is what I have
> been hung up on. I am writing this data to an array that is indexed
> out of the loop.
0 Kudos
Message 4 of 7
(5,250 Views)
Terry,

Try Reg's idea, it should work.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(5,250 Views)
You may want to have a case structure inside of your while loop. You can have a stop button from your front panel stop the while loop. Inside the while loop, you can have a case structure which only executes if "so much time" has passed. Inside this case statement, you can write the data to a file.

To determine when "so much time" has passed, you can use the "Wait Until Next ms Multiple" VI to know how much time has passed. For example, if your while loop is set to execute every 100 ms, then you know that every 10 loops is 1 second. Using this, your case statement can determine how much time has passed and only write data to file when you want to.
J.R. Allen
Message 6 of 7
(5,250 Views)
In addition to what has been suggested, I want to recommend the attached vi as another method of accomplishing the same goal. The original vi is on developer excahnge.
0 Kudos
Message 7 of 7
(5,250 Views)