04-17-2024 12:33 PM
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
Solved! Go to Solution.
04-17-2024 01:21 PM
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.
04-17-2024 11:47 PM
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).
04-18-2024 09:44 AM
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.
04-18-2024 12:18 PM
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.
04-18-2024 07:25 PM - edited 04-18-2024 07:34 PM
@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.
04-18-2024 07:36 PM
04-22-2024 11:16 AM
thank you! i was definitely overthinking this