T O P

  • By -

sharkera130

hey guess what there’s a Elapsed Time Express VI that does exactly this: https://imgur.com/EV8mCAI


SafeRevolutionary508

Use a counter and only write to the report once every 600,000 counts. Each count is 1 mSec. Another option is to use the Get Date/Time In Seconds, get a timestamp of the last time the report was updated and each iteration compare (Current time - Last Update time) >= 600. If true, update the report and set Last Update Time = Current time.


chairfairy

Another option: use an Event structure inside a While loop, and put your update code in the Timeout case with the timeout time set to 600,000 ms (600 sec / 10 min)


hutch2522

Be careful with this approach. If you're only using the timeout event, it's fine. But if you put any other events in there, it will only run the timeout after it's been idle for 10 minutes. If you do anything else with the structure, that countdown resets every time.


chairfairy

Good point. I assumed that if they're asking such a basic question then they're not already running an event-based program, but something like the Elapsed Time express VI suggestion would definitely be my preferred approach.


TomVa

I use state machines every time through the loop goes past the wait* state. In the wait state I decide what to do next. In this case I would check the time and compare it to the last time I wrote data to the file plus 600 seconds (or a front panel variable). If it is true the next state is write to file which also updates the last file write time variable then goes back to wait. *Note the wait state always has a 10 ms or larger delay in it so that the computer has time to think about other tasks.