LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using more than one elapse timer causing skipping

Solved!
Go to solution

I created a simple program similar to a stop watch that counts up and down. It works the first time you go forward and backward but after that they start skipping incremental based on the other timer. is there a simple fix to this issue? i tried it with almost every timer operation in LabVIEW and they all do the same thing

Download All
0 Kudos
Message 1 of 8
(521 Views)

I don't have the newest version of LV installed to run your VI but I think one point of confusion might be that the elapsed time function doesn't just count the time when you are in the true cases. It's just looks at the current time and checks how much time has elapsed since the function was first executed (or reset).

 

Instead of having two while loops tracking the forward and backwards time I would try to put it all in one loop and check how much time has elapsed from one iteration to another. Then you can take that elapsed time and add or subtract it from your total time elapsed depending on what buttons are pressed.

0 Kudos
Message 2 of 8
(493 Views)

I agree that running three greedy loops, all peppered with value property nodes is completely misguided to whatever you are trying to do.

 

All you need is exactly one loop and a clean state machine. No locals and value properties anywhere. You also need to define the loop rate. I would also initialize the shift registers.

Can forward and backward really be true at the same time?

 

(Yes, please do a "save for previous" before attaching code so more can look at it).

0 Kudos
Message 3 of 8
(461 Views)

I put all the code in one loop and saved it for a previous version of labview. Im still stuck on how to make the timers not skip. I might not need them to be running at the same time as well.

0 Kudos
Message 4 of 8
(435 Views)

Why do you need separate Forward and Backward buttons?  Either it should move forward or backwards based on the state of a direction boolean and the TestStarted boolean.  This would allow for a single counter that updates the relevant shift register time.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 5 of 8
(429 Views)

@amthonys777 wrote:

I put all the code in one loop and saved it for a previous version of labview. Im still stuck on how to make the timers not skip. I might not need them to be running at the same time as well.


  • Next time, please save for 2020 or below.
  • There is no reason in the world to maximize the front panel and diagram to the screen. I don't like to stare at mostly whitespace!
  • I have no idea why one of your booleans is a typedef (that you forgot to include).
  • Your loop still has no timing and runs unpredictably, as fast as the computer allows.
  • You still have not explained why forward and backward can be true simultaneously. How does that physically work?
  • Your time is elapsing even if the case is FALSE, of course, you just don't read it out!

 

0 Kudos
Message 6 of 8
(414 Views)
Solution
Accepted by topic author amthonys777

See if this can give you some ideas....

 

 

Message 7 of 8
(411 Views)

thank you! i was definitely overthinking this

0 Kudos
Message 8 of 8
(372 Views)