LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

want a cumulative runtime counter

want a motor runtime counter in LabVIEW that:

  1. Starts counting seconds, minutes, and hours when a Boolean input (Motor_ON) is True.

  2. Pauses counting when the Boolean is False.

  3. Resumes from the paused value when Boolean becomes True again.

  4. Works without using Wait(ms) or blocking delays, because delays could interfere with sensors or valve updates in your main program.

This is a non-blocking timer approach, which is ideal for real-time control.

 

thank you

0 Kudos
Message 1 of 3
(144 Views)

Hi rajapalani,

 


@rajapalani wrote:

want a motor runtime counter in LabVIEW that:

  1. Starts counting seconds, minutes, and hours when a Boolean input (Motor_ON) is True.


This sometimes is called an "operative hour counter"…

 

Your request comes up from time to time in this forum, and I already answered such request in former times.

Did you search the board for related topics?

 

Generic answer:

  • Keep your counter value in a file to preserve the value even when stopping the executable and starting again.
  • Load the value on start of the executable.
  • Increment the value, based on your condition.
  • Do the increments in a loop where you know the iteration time. (non-blocking behaviour)
  • Use timestamp differences to add to your counter value, don't rely on iteration counts…
  • Save the value when exiting the executable, and save in between to prevent data losses due to crashes…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(135 Views)

The Elapsed Time Express VI should be able to do this.

 

Use the "Set Start Time (s)" input to load the previous run time to start counting from.

========================
=== Engineer Ambiguously ===
========================
Message 3 of 3
(73 Views)