取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 13 条)
4,374 次查看
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 项奖励
2 条消息(共 13 条)
4,370 次查看
...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 项奖励
3 条消息(共 13 条)
4,357 次查看

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 项奖励
4 条消息(共 13 条)
4,351 次查看
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 项奖励
5 条消息(共 13 条)
4,340 次查看

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 项奖励
6 条消息(共 13 条)
4,281 次查看

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 项奖励
7 条消息(共 13 条)
4,258 次查看
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 项奖励
8 条消息(共 13 条)
4,247 次查看

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

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

0 项奖励
9 条消息(共 13 条)
4,231 次查看
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 项奖励
10 条消息(共 13 条)
4,227 次查看