LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

eliminating lag in a looping subVI

I have this subVI looping at about 1 Hz, collecting and displaying live data, but there's a mysterious lag between reality the loop.

For example, when I push a stop button on the front panel of the main VI, the loop doesn't see the stop button (passed by reference) for several seconds.

I thought this might be a referece issue, so I had the loop read the Scroll Lock key as it might read it more quickly. But the lag is still there.

How can I fix this?
0 Kudos
Message 1 of 5
(2,419 Views)
Looping at 1Hz, you're loop is only going to read everything inside the loop once every second.
 
So unless you happen to hit the button a millisecond before the loop start it's next iteration, there will always be a lag between the time you click the button and it gets read in the loop again.
 
An easy way to fix this would be to loop at 10Hz but only collect and display the data every ten iterations. Maybe use a Case Structure inside the While Loop. Just make sure the button reference is not inside the case that only runs every 10th iteration.
 
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 5
(2,416 Views)
This lag spans several iterations of the loop, sometimes 20 or 30. I don't like having to wait 20 or 30 seconds for my app to stop.

Stopping in a second or two would be fine.
0 Kudos
Message 3 of 5
(2,413 Views)
Hi

Show us the code, they say that four eyes are better than twoSmiley Wink

xseadog
0 Kudos
Message 4 of 5
(2,408 Views)
As was mentioned, can you post the code?
 
There's probably other things going on that are introducing delays, but without seeing it.....
 
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 5 of 5
(2,401 Views)