LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two parallel different subvi running at the same time

Hello everyone,

I would like to make two different subVIs running simultaneously exactly at the same time

I explain : since they're different they won't have obligatory the same inputs so necessarily one will run before the other but I need that even if the inputs of one of them arrive before, it waits until the other's come as well so as to start exactly at the same time.

My program consists of two subVIs, one of a stepper motor and the other of an ink-jet printer and its printhead will be placed on the movable portion of the stepper motor and as the motor moves, the ink-jet printer starts to print continuously.

Neither the printer nor the motor can start before the other, otherwise either the text won't be at its adequate place on the product or since it's an ink-jet one if it stops moving it will print everything on the same column which is not readable.

In other terms how can I make multithreading with labview?

Please I need your help as soon as possible.

Thank you in advance 🙂

0 Kudos
Message 1 of 18
(5,654 Views)

Put a Wait for Notification in each VI. Start both VIs. The "working" code in each is set to run after the notification is received. The main program generates the notification when everything is ready.

 

Lynn

0 Kudos
Message 2 of 18
(5,648 Views)

LabVIEW is parallel by default. You can syncronize with a flat sequence structure as shown below.

parallel task2.png

The "Move motor 1" VI above won't run until the Calc print head pos. "thread"  at the bottom left is finished.

0 Kudos
Message 3 of 18
(5,631 Views)

Depending on what runs before these subVIs, you might be able to share the last input you expect to reach the two VIs.  For example, you can have an error fed as an input that comes from the same point.  They both receive it at the same time and get started computing.

0 Kudos
Message 4 of 18
(5,621 Views)

Hi Yasmine,

Find the Rendezvous under the Synchronization pallete.  Use it to make your sub-VIs wait at a common location.

See example attached.

 

Hope it helps,

Cheers! 

 

P.S. The example runs two copies of one "reentrant" subVI.

Download All
0 Kudos
Message 5 of 18
(5,589 Views)

Thank you very much for all your responses 🙂

I will try these different alternatives and tell you if it woks with my VI's functionality.

 

Have a good day.

0 Kudos
Message 6 of 18
(5,583 Views)