From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple VIs running parallely : how to run part of the code of one VI sequentially

Hi everybody,

I apologize if my question is not well formulated but honestly I had hard time to formulate it correctly.. and thus I couldn't find the answer on the forum 😕 while it could be present

 

Here is the situation :

 

Imagine you have two VIs running at the same time. The first VI is dedicated to the control of, for example, the source of an electrical current while the second VI reads this current.

 

In each VI a sequence of subVI is run in order to either (first VI) control or read (second VI) the current source. An important constraint is that no read operation should be tried while the first VI is running its sequence of (control-)sub Vis and vice-versa.

 

In other words I would like to be able to send to the labview-queue a list of sub-VIS to run one after the other. Is it possible ?

 

For implementation reasons I need to keep two VIS running independently.

 

If the above explanation is not clear the situation is similar to the attached example where I would like the second VI to increment by +1 only when the 1st VI completed one turn of the while loop (+5 increment).


Again because of my implementation I don't want to share a variable or to send events between the two VIS. I would like to send to labview the five "+1" operations of the 1st VI, as a block of operations to run "in one time" (i.e. with no operations of the second VI inbetween)

 

Sorry for the big post but I tried my best to be clear 😉

Thanks a lot for the help

Alex

Download All
0 Kudos
Message 1 of 4
(2,329 Views)

If they are talking to the same instrument, I would do everything in 1 loop and send the data out using a Queue or Notifier.

 

The other obvious option is to use an Action Engine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,301 Views)

crossrulz a écrit :

If they are talking to the same instrument, I would do everything in 1 loop and send the data out using a Queue or Notifier.

 

The other obvious option is to use an Action Engine.


Thanks a lot crossrulz for the quick answer.

Actually I really need to keep these two VIs that run in parallel, because my program is actually much bigger than the small example I gave.

 

If I understand well there is no way in Labview to send to tell the CPU :

 

"Once you start to execute this group of SubVI(or part of the block diagram), do not allow any other running VI to execute anything?"

0 Kudos
Message 3 of 4
(2,289 Views)

@Alex1985 wrote:

 

"Once you start to execute this group of SubVI(or part of the block diagram), do not allow any other running VI to execute anything?"



Semaphores may serve your purpose for this.  It is designed to keep 2 parts of code from executing simultaneously.  I'm not sure how easy it would be to adapt it to this "one vs. anything/everything else" the way you are describing it.

0 Kudos
Message 4 of 4
(2,284 Views)