LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Asynchronous Calls to Same SubVI

Solved!
Go to solution

Hello,

 

I am developing a program for the cRIO-9053 in which I'm trying to collect data from multiple inverters over Modbus in a timed loop. When I do all of it in the top-level VI it works perfectly, but to make it cleaner and more modular I want to encapsulate each of these data collection loops in a subVI. Since these subVIs are meant to run indefinitely I'm trying to use asynchronous call-and-forget calls to keep them from blocking the rest of the program from executing, but when I try to make multiple calls, only one seems to be executing and I'm not sure what the problem is. This is the code I'm using to make the asynchronous calls:

 

Capture.PNG

The one subVI feeding into the async subVI just initializes an RT FIFO and some other variables to be able to route commands back to the inverter loops and likewise the two wires coming in from the top are references to user events that contain RT FIFOs to get the data out of the loops. I'm able to send and receive data to and from the first Modbus server that I'm using for testing just fine, but not the second one for some reason. Any help on getting this working would be appreciated as I'm pretty new to Labview.

0 Kudos
Message 1 of 6
(205 Views)
Solution
Accepted by topic author kspdra

In the SubVI you are running, check the VI properties >> Execution >> Reentrancy. If it is set to "Non-reentrant execution" then you can only run one instance at a time.

0 Kudos
Message 2 of 6
(185 Views)

Also, try using the 0x40 option instead of 0x80. 

0 Kudos
Message 3 of 6
(183 Views)

Thank you, I didn't realize I had to change that setting to get reentrant execution. I tried it with and without the x40 flag and both work; it looks like the flag is only needed when you use the same VI reference for all instances of the subVI like so:Capture 2.PNG

Do you know if there's any performance difference between doing it this way vs. having separate references for each call?

0 Kudos
Message 4 of 6
(131 Views)

For your use case, I don't think you will notice a difference.

 

If you had some persistent memory (think uninitialized shift registers, or feedback nodes) and you were calling the SubVIs over and over, then you would want a separate reference for each one.

0 Kudos
Message 5 of 6
(118 Views)

Understood. Thanks again for your help.

0 Kudos
Message 6 of 6
(65 Views)