12-18-2006 10:17 AM
12-18-2006 10:42 AM
12-18-2006 11:52 AM
12-18-2006 12:08 PM
LabVIEW runs multithreaded, so VI's started in parallel also run in parallel. I use this in my programs e.g. to permanently check 'safety switches' (of course the life critical are wired in hardware) and e.g. Display warning lights, run an alarm buzzer, ...
The tricky thing is to get such an parallel running VI started and stopped correctly. I use the following scheme:
a) use a global variable to pass run/stop status
b) set up a sequence as following:
1st frame: set the global to 'RUN'
2nd frame: run the main application part and the sub-vi in parallel
c) to stop the parallel running VI the main loop must set the global to 'STOP'. Otherwise you will not be able to exit this frame of the sequence.
I should have an simple example somewhere (LabVIEW 8.2). Let me know if you need it.
Roland
12-18-2006 12:11 PM
Yes, the front panel would still halt operation, but you can change the values of the controls without any code running in the front panel by using references. I understand what you mean though about having a lot of them. The other option is to use globals like you are doing, but calling the subvi dynamically so that it starts to run and your main VI continues to run as well. Although I wouldn't personally go this route if it's just for updating front panel controls. I try to avoid globals as much as possible.
If you aren't familiar with calling VIs dynamically, it's done by using Open VI Reference, then using an invoke node to call the Run VI method. Then just wire false to the "wait until done" input.
12-18-2006 12:15 PM
12-18-2006 12:34 PM
Hi RExlter,
Thanks for the advice. In truth my application is far more complicated and parts of my code already use dynamic linking to call certain subvis and leave them running in the background on an internal loop without waiting for them to finish. These background subvi's constantly take measurements and monitor switches to ensure certain criteria are met etc. to allow the code to continue. Unfortunately, I don't want OperationA, as shown in my attachment, to be called this way if I can help it - which is why I was hoping there would be a simple method I hadn't thought of for calling it and continuing the main code. It seems I may have to re-write all the code to do either what you suggest or what MarcA suggests. I'll think about it and work out what will be best.
Many thanks everyone for your assitance!
Best wishes,
and Merry Christmas!
Riggy
12-18-2006 12:35 PM
12-18-2006 01:01 PM
Good luck to you.
I have come to certain situations where I want to do exactly what you want. I have wanted to do it so that I could pass inputs to a VI by wire but have it run dynamically, however I never found a way to do it. I figured that if the subVI didn't return any values, there should be a way to have it run in the background.
Maybe we'll see this feature added at some point, but there might also be something that I'm not aware of which would create problems.
01-17-2007 12:40 PM - edited 01-17-2007 12:40 PM
Message Edited by Micah Boyd on 01-17-2007 12:42 PM