LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

suspending a parallel while loop

I am running two while loops in parallel, one of which deals with the user interface, the other deals with instrument IO. I want to call a subVI from my UI loop, and I want the other loop (the instrument IO loop) to be suspended while this sub is called. Does anyone have any ideas as to how I might do this?
 
I am working on labVIEW 8.5, using the touch panel module (i.e. the solution needs to be something that will run on a touch panel device).
 
Thanks
 
mstudio
0 Kudos
Message 1 of 13
(3,458 Views)
In the Instrument IO loop use a case structure to select operate or suspend modes. If you also do initialization or other things you may want to make this a state machine where suspend is one of the states. Pass the commands (to operate or suspend) via a queue.

The loop is not actually suspended. It keeps running but the IO operation is suspended. Make sure the loop has a small delay to avoid using all the CPU resources.

Lynn

Message Edited by johnsold on 05-16-2008 10:57 AM
0 Kudos
Message 2 of 13
(3,454 Views)
...or use Semaphore for this. With Semaphore you can be sure that IO loop already stopped when you will call SubVI in UI loop.
 
best regards,
Andrey.
0 Kudos
Message 3 of 13
(3,441 Views)

Thanks for the ideas guys, just to clarify it is important that my IO loop is suspended and not stopped, I should have mentioned that the IO loop is infact a state machine in itself, and it is important that it remains in the correct state while the other subVI is called. Is semaphore suitable for this?

Thanks

mstudio

0 Kudos
Message 4 of 13
(3,435 Views)
Hi,
 
If under "Suspend" term you assuming stop iterations temporarily, then Semaphore is good for you. When Semaphore released, then iterations will be continued.
Anyway I mean something like this:
 
best regards,
Andrey.
0 Kudos
Message 5 of 13
(3,424 Views)

Thanks for that Andrey, I'll give that a try. On a slightly different note, I tried putting a "wait for front panel activity" function in my UI loop, but I found that this seemed to suspend both loops - is that what I should expect, or did I do something wrong?!

mstudio

0 Kudos
Message 6 of 13
(3,365 Views)

Did you implement the example shown with the semaphore and added the "wait for FP activity" to it?

If so, then both loop would be affected since the bottom loop is "locked out" by the semaphore..  That is if the semaphore was activated before the wait.

Can you post what you have done?

RayR

0 Kudos
Message 7 of 13
(3,342 Views)
No no, there was no semaphore when I tried using the wait for front panel activity function. I cannot post what I am doing, as far as a description goes, I have one loop which is essentially a fairly standard state machine, and another loop which is running in parallel, which deals with the user interface. When I placed the wffpa function in the UI loop, the state machine also seemed to wait...
0 Kudos
Message 8 of 13
(3,331 Views)

Are you using any queue or notifiers between the two loops? 

In other words, is there a mechanism that affects the other loop?

0 Kudos
Message 9 of 13
(3,315 Views)
Not at present, no. There are some variables that are shared between the loops, but other than that they are essentially seperate processes. I should mention that the application is being run on a touch panel device - I don't know whether that affects the functionality of the wait for FP activity.
0 Kudos
Message 10 of 13
(3,311 Views)