Search code examples
labview

Seeking suggestion to count time inside the loop


I am trying to measure/count the time inside the while loop, I tried a couple of methods but couldn't find the solution yet.

Here is my current VI.

enter image description here

In short, I am trying to measure the time as long as the "Boolean is on/true" and once it's off/false the time must be displayed.

If something is not clear then please let me know.


Solution

  • I may be repeating Fourier's answer, but typing it in two different forms may be helpful to you since I note you haven't accepted that answer yet.

    1. Remove the outer While Loop. It is superfluous.
    2. Then do this:

    Turn on bool Turn off bool

    In the "turn on" frame, you gather the current Tick Count and stash it in a shift register. In the "turn off" frame, you gather the Tick Count again and subtract. In all the other frames, make sure you wire the two tunnels together so you don't lose your Tick Count. Side note: you probably want Boolean to be an indicator, not a control, so your user cannot click on it and toggle it directly.