11-17-2014 04:27 PM
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 🙂
11-17-2014 04:30 PM
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
11-17-2014 05:15 PM
LabVIEW is parallel by default. You can syncronize with a flat sequence structure as shown below.
The "Move motor 1" VI above won't run until the Calc print head pos. "thread" at the bottom left is finished.
11-17-2014 05:58 PM
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.
11-18-2014 01:51 AM
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.
11-18-2014 02:21 AM
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.