How Do I Run a Piece of Code Once Every Specified Time Interval in LabVIEW?

Updated Sep 17, 2018

Reported In

Software

  • LabVIEW

Issue Details

I have a program that runs constantly, but I need my program to be able to do a certain task every 8 hours. Is there any way to do this in LabVIEW?

Solution

This is possible, using a combination of LabVIEW's built-in time functions and a Shift Register in a While Loop
  1. Create a Shift Register on the edge of your While Loop
  2. Create a Time Stamp control to initialize the Shift Register when you first want the section to run
  3. Create a Case Structure around the section of code you want to run at the interval
  4. Compare the time from the Shift Register to see if Get Date/Time in Seconds is past the time the code should run next with Greater Than or Less Than
  5. Route the boolean output from this comparison into the selector on your Case Structure 
  6. If the output of Get Date/Time in Seconds is past the goal time, have the case add your interval to the goal time in seconds and pass this new goal time to the 
  7. If the output of Get Date/Time in Seconds is before the goal time, wire the goal value straight through the Case Structure

WAS THIS ARTICLE HELPFUL?

Not Helpful