LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous call and collect passing information from previous iteration of the loop

Solved!
Go to solution

Hello All, 

 

This is something simple I've been struggling for two days now. I'm establishing asynchronous TCP connection and while waiting for it to be established, I'm polling other units (whose connections were already established) using the flat sequence loop. When TCP timeouts for establishing connection expire, I call on wait for asynchronous call and I need to pass TCP connection status to the next iteration of the loop. If connection was established, don't start asynchronous call, only do the flat sequence, if not established, start over.  

 

I'm using slightly modified version of example "Asynchronous Call and Collect" for simplicity and I need to do the following:

 Start asynchronous call, compare double variable from previous loop to 0.5, which is initialized with 999, when it equals less than 0.5, I want to stop the asynchronous call and wait on call on the following iterations of the loop.
 
The code that I've attached compares the value to 0.5, but, even if conditions are satisfied, it still updates the Boolean value which, in turn, initiates asynchronous call on the next iteration of the loop. I know why it's happening, I just don't know how to fix it.
 
I've tried swapping order of asynchronous call and wait for call and it does what I want, but the program is idle while waiting for the call is running, so it defeats the purpose. I can't put flat sequence first, the order has to be start call, do stuff, wait on call. I've tried all possible combinations of feedback nodes and shift registers but can't achieve what I need. 
 
Thanks for help.
0 Kudos
Message 1 of 5
(546 Views)

Is this what you are trying to do?

0 Kudos
Message 2 of 5
(510 Views)

Thank you for taking a look, but this won't work. I don't want to delay my execution after I start asynchronous call, I want to have a while loop in between those functions that runs for 3 seconds. 

0 Kudos
Message 3 of 5
(388 Views)
Solution
Accepted by topic author John32d

@John32d wrote:

Thank you for taking a look, but this won't work. I don't want to delay my execution after I start asynchronous call, I want to have a while loop in between those functions that runs for 3 seconds. 


So just replace the "Stall Data Flow" vim with a while loop that performs your "execution".

0 Kudos
Message 4 of 5
(370 Views)

I have replaced feedback nodes of comparisons with regular comparisons inside the loop and it did the trick. 

0 Kudos
Message 5 of 5
(299 Views)