LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopwatch with a dynamic input (boolean)

Solved!
Go to solution

1. Yes, I agree that only one boolean before the case can drive the output of the VI as you suggest. The others ones were initially placed them just to check that the subVI was doing what I needed. As I mentioned before, I’m not fully familiar with the language yet.

2. You mean the wait inside the “Punishment” case? That one will be removed — it’s actually a time-out that belongs in the main VI.

 

3.About the lever input: that is exactly the issue I’ve been struggling with. As I mentioned to the others, when I was using the Elapsed Time Express VI I could get that kind of dynamic reset, but I haven’t managed to reproduce it properly inside my subVI. What I really want is to keep track of how long the lever stays active before each reset — basically, the duration of each state. I already tried with queues, notifiers, and property nodes, but I’m not sure what I’m doing wrong in that part.

Alternatively, I’m also open to a way of replacing the Elapsed Time while still keeping the previous value before each reset. 

 

I appreciate that you actually went through the code and provided detailed feedback.

 

0 Kudos
Message 11 of 13
(120 Views)

Hi pgon,

 


@pgon0006 wrote:

I’m using Elapsed Time successfully in the main VI, and I just need a way to retain the final value before it resets. 

 

I actually found a screenshot that shows exactly what I need (quite simple, right?) ; now I just have to figure out how to implement it without a while loop, or possibly integrate it into the main VI’s loop.


  • Your VI exactly does what you want: retain the last "Elapsed time" value until you start the next counting.
  • To "implement this without using a while loop" sounds like a silly requirement: why?
  • As you already have an outer while loop: anchor the shift register onto that loop and you will easily reach your goal…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 13
(95 Views)

Hi GerdW,

Thanks for your message. Let me clarify a few things point by point:

  1. “Your VI exactly does what you want: retain the last 'Elapsed time' value until you start the next counting.” That’s true now—but only after I restructured it. Initially, the Elapsed Time logic was placed inside a case structure, which prevented it from retaining the final value properly (that was part of the original question). I later moved that logic out of the case and into the main while loop, which solved the issue.

  2. “To implement this without using a while loop sounds like a silly requirement: why?” Just to clarify, I never intended to avoid using a while loop altogether. My main VI already runs inside one. What I wanted to avoid was a nested while loop, which was part of a subVI that i was trying to sustitute Elapsed time. That nested loop was blocking the execution of the main VI, and it wasn’t necessary for my use case.

  3. “As you already have an outer while loop: anchor the shift register onto that loop and you will easily reach your goal…” Exactly—that’s what I ended up doing. I found a solution in another forum post (that i attached in the other response), where someone had implemented a clean stopwatch subVI. I adapted that approach by placing the timing logic directly in the main while loop and using its output in the specific case where it’s needed. That way, I avoided nesting and kept the VI responsive.

Thanks for confirming the approach.

0 Kudos
Message 13 of 13
(68 Views)