LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finishing a task while a loop continues to the next iteration

Hi,
I'm trying to design an interface where the user touches a target on a touch screen at a set speed provided by a metronome generated within labview. When the screen is touched the target is replaced by another circle indicating whether or not the target was hit (I'm using image masks to achieve this). My problem is that if the target is touched too close to the end of the time it takes longer for the circle to redraw than for the iteration to finish, so both the rest of the program has to wait for the picture. This means that my metronome misses beats (it is set to beat when the time is a multiple of the speed) and the presentation of the next target is delayed. At high speeds entire iterations see
m to be missed! Is there away that my picture can redraw while the rest of the program continues uninterupted? I've considered multi-threading it, but don't know how. Any help or other suggestions would be MUCH appreciated!!
Thank you!!
0 Kudos
Message 1 of 2
(2,388 Views)
You may be experiencing operating system limitations. Most desktop OSes can take variable and significant amounts of time, especially to respond to user inputs and to redraw the screen image. 10s to 100s of milliseconds latency, even with a fast processor may not be unusual.

As for multithreading, LV does a pretty good job on its own. Set up one loop to handle user input and screen images only. Put all other processing into a separate loop - your metronome, any decision making, data collecting and analysis, etc. Communicate between the loops with queues or notifiers. Put a wait in each loop so LV's scheduler will share processing time between the loops. Try not to do much of anything else during the critical time period. And try to figure out if you c
an detect OS latencies in your data and handle them appropriately during the analysis.

Lynn
Message 2 of 2
(2,388 Views)