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: 

Using Asynchronous Calls in a While Loop...How to "Skip" Node and Only Retrieve Data As it is Processed

Solved!
Go to solution

Maybe I'm not understand asynchronous calls...but I thought that I should be able to call another VI and essentially "skip" it's node and only receive data as the called VI processes it.  In other words, similar to the Run VI Method, I can wire a Wait Until Done? with a False and the main VI will not wait for the other VI to finish running.  The main VI keeps running and as it passes the called VI's node, it will receive data if it happens to be there. 

 

How can I call a VI in a while loop and not wait for it to spit out results?  Data flow is my enemy on this one...

 

The first VI processes its own numbers (using the iteration counter) and displays them on the FP.  The other indicators receive data from the called VI.  I want to be able to bypass the blue circled node and receive data only as it is available.

 

Any help is appreciated.  Thanks.

Asynch VI's

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 1 of 11
(4,476 Views)

You should use queues, notifiers or user events to pass asychronous data between tasks.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 11
(4,471 Views)

I agree and do that for most applications.  I was trying to better understand how this functionality can be used.  Any ideas?  I've played around with it for a while, but I can't seem to fully grasp it.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 3 of 11
(4,465 Views)
Solution
Accepted by topic author Nathan_S

From what I have been told by NI the "Start Asynchronous Call" is the preferred method for starting background tasks. This call is generally used to run tasks in the background. For instance, you have a log process. When your application starts it would  use the "Start Asynchronous Call" to start the log process and then move on to other stuf. The log process would then be happily running in the background and the main application is free to do other things. Naturally when implementing these types of systems you need a way to coordinate things like exiting the application. That is where the queues and stuff come it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 11
(4,457 Views)

@Mr._Bass wrote:

Maybe I'm not understand asynchronous calls...

...

How can I call a VI in a while loop and not wait for it to spit out results?  Data flow is my enemy on this one...

 


To answer your question, your "Start asynchronous call+ wait for asynchronous call" combo is functionally identical to a plain call by reference node, because the wait is blocking the calling program from proceeding.

 

Your subVI will NOT return any intermediary data, and that does not depend in the placement of the indicator. Data is only returned once the subVI has completed.

 

As has been said, you need to use other means to update across VIs (queues, notifiers, shared variables, control references+value properties, Action engines, etc.)

Message 5 of 11
(4,451 Views)

Hi,

A very late reply.

 

Maybe using an event structure can be helpful. Upon value change, a case structure may process whatever value is out of the VI. Otherwise, just don't bother about the VI's results by wiring a default dummy value or so...

0 Kudos
Message 6 of 11
(4,237 Views)

alihzubi wrote:

Maybe using an event structure can be helpful. Upon value change, a case structure may process whatever value is out of the VI. Otherwise, just don't bother about the VI's results by wiring a default dummy value or so...


You probably need to give much more details what you actually mean here, maybe attach a small example. To me, nothing you said makes any sense so far.

0 Kudos
Message 7 of 11
(4,228 Views)

running a prallel while loop that updates an indicator the chnage of the value of which would trigger an event (using an event structure) may solve the problem.

I hope this makes some sense!

0 Kudos
Message 8 of 11
(4,221 Views)

A value change of an indicator does not fire an event.

0 Kudos
Message 9 of 11
(4,209 Views)

what about using Value property (signaling)?

0 Kudos
Message 10 of 11
(4,199 Views)